Animals harbor specialized neuronal systems that are used for sensing and coordinating responses to changes in oxygen (O2) and carbon dioxide (CO2). In Caenorhabditis elegans, the O2/CO2 sensory system comprises functionally and morphologically distinct sensory neurons that mediate rapid behavioral responses to exquisite changes in O2 or CO2 levels via different sensory receptors. How the diversification of the O2- and CO2-sensing neurons is established is poorly understood. We show here that the molecular identity of both the BAG (O2/CO2-sensing) and the URX (O2-sensing) neurons is controlled by the phylogenetically conserved SoxD transcription factor homolog EGL-13. egl-13 mutant animals fail to fully express the distinct terminal gene batteries of the BAG and URX neurons and, as such, are unable to mount behavioral responses to changes in O2 and CO2. We found that the expression of egl-13 is regulated in the BAG and URX neurons by two conserved transcription factors-ETS-5(Ets factor) in the BAG neurons and AHR-1(bHLH factor) in the URX neurons. In addition, we found that EGL-13 acts in partially parallel pathways with both ETS-5 and AHR-1 to direct BAG and URX neuronal fate respectively. Finally, we found that EGL-13 is sufficient to induce O2- and CO2-sensing cell fates in some cellular contexts. Thus, the same core regulatory factor, egl-13, is required and sufficient to specify the distinct fates of O2- and CO2-sensing neurons in C. elegans. These findings extend our understanding of mechanisms of neuronal diversification and the regulation of molecular factors that may be conserved in higher organisms.