Segregating cells into compartments during embryonic development is essential for growth and pattern formation. Physical mechanisms shaping compartment boundaries were recently explored in Drosophila, where actomyosin-based barriers were revealed to be important for keeping cells apart. In vertebrates, interhombomeric boundaries are straight interfaces, which often serve as signaling centers that pattern the surrounding tissue. Here, we demonstrate that in the hindbrain of zebrafish embryos cell sorting sharpens the molecular boundaries and, once borders are straight, actomyosin barriers are key to keeping rhombomeric cells segregated. Actomyosin cytoskeletal components are enriched at interhombomeric boundaries, forming cable-like structures in the apical side of the neuroepithelial cells by the time morphological boundaries are visible. When myosin II function is inhibited, cable structures do not form, leading to rhombomeric cell mixing. Downregulation of EphA4a compromises actomyosin cables and cells with different rhombomeric identity intermingle, and the phenotype is rescued enhancing myosin II activity. Moreover, enrichment of actomyosin structures is obtained when EphA4 is ectopically expressed in even-numbered rhombomeres. These findings suggest that mechanical barriers act downstream of EphA/ephrin signaling to segregate cells from different rhombomeres.