Glia are required for axon pathfinding along longitudinal trajectories, but it is unknown how this relates to the molecular paradigm of axon guidance across the midline. Most interneuron axons in bilateral organisms cross the midline only once. Preventing them from recrossing the midline requires the expression of Robo receptors on the axons. These sense the repulsive signal Slit, which is produced by the midline. The lateral positioning of longitudinal axons depends on the response to Slit by the combination of Robo receptors expressed by the axons, on selective fasciculation, and on longitudinal (lateral) glia. Here, we analyse how longitudinal glia influence reading of the ‘Robo code’ by axons. We show that whereas loss of robo1 alone only affects the most medial axons, loss of both glial cells missing (gcm) and robo1 causes a severe midline collapse of longitudinal axons, similar to that caused by the loss of multiple Robo receptors. Furthermore, whereas ectopic expression of robo2 is sufficient to displace the medial MP2 axons along a more lateral trajectory, this does not occur in gcm–robo1 double-mutant embryos, where axons either do not extend at all or they misroute exiting the CNS. Hence, lateral neuron–glia interactions steer the response of axons to the Robo code.