We have examined cell death within lineages in the midline of Drosophila embryos. Approximately 50% of cells within the anterior, middle and posterior midline glial (MGA, MGM and MGP) lineages died by apoptosis after separation of the commissural axon tracts. Glial apoptosis is blocked in embryos deficient for reaper, where greater than wild-type numbers of midline glia (MG) are present after stage 12. Quantitative studies revealed that MG death followed a consistent temporal pattern during embryogenesis. Apoptotic MG were expelled from the central nervous system and were subsequently engulfed by phagocytic haemocytes. MGA and MGM survival was apparently dependent upon proper axonal contact. In embryos mutant for the commissureless gene, a decrease in axon-glia contact correlated with a decrease in MGA and MGM survival and accelerated the time course of MG death. In embryos mutant for the slit gene, MGA and MGM maintained contact with longitudinally and contralaterally projecting axons and MG survival was comparable to that in wild-type embryos. The initial number of MG within individual ventral nerve cord segments was increased by ectopic expression of the rhomboid gene, without changing axon number. Extra MGA and MGM were eliminated from the ventral nerve cord by apoptosis to restore wild-type numbers of midline glia. Ectopic rhomboid expression also shifted MGA and MGM cell death to an earlier stage of embryogenesis. One possible explanation is that axon-glia contact or communication promotes survival of the MG and that MG death may result from a competition for available axon contact.