Aerobic metabolism is fundamental for almost all animal life. Cellular consumption of oxygen (O(2)) and production of carbon dioxide (CO(2)) signal metabolic states and physiological stresses. These respiratory gases are also detected as environmental cues that can signal external food quality and the presence of prey, predators and mates. In both contexts, animal nervous systems are endowed with mechanisms for sensing O(2)/CO(2) to trigger appropriate behaviors and maintain homeostasis of internal O(2)/CO(2). Although different animal species show different behavioral responses to O(2)/CO(2), some underlying molecular mechanisms and pathways that function in the detection of respiratory gases are fundamentally similar and evolutionarily conserved. Studies of Caenorhabditis elegans and Drosophila melanogaster have identified roles for cyclic nucleotide signaling and the hypoxia inducible factor (HIF) transcriptional pathway in mediating behavioral responses to respiratory gases. Understanding how simple invertebrate nervous systems detect respiratory gases to control behavior might reveal general principles common to nematodes, insects and vertebrates that function in the molecular sensing of respiratory gases and the neural control of animal behaviors.