Many sensory behaviors are flexible, allowing animals to generate context-appropriate responses to changing environmental conditions. To investigate the neural basis of behavioral flexibility, we are examining the regulation of carbon dioxide (CO2) response in C. elegans. CO2 is a critical sensory cue for many animals, mediating responses to food, conspecifics, predators, and hosts. In C. elegans, CO2 response is regulated by the polymorphic neuropeptide receptor NPR-1: animals with the N2 variant of
npr-1 avoid CO2, while animals with the Hawaiian (HW) variant or an
npr-1 loss-of-function (lf) mutation appear virtually insensitive to CO2. We examined the mechanism by which NPR-1 regulates CO2 avoidance behavior. We found that ablation of URX neurons in
npr-1(lf) mutants restores CO2 avoidance, suggesting that NPR-1 enables CO2 avoidance by inhibiting URX. In
npr-1(lf) mutants, O2-induced activation of URX inhibits CO2 avoidance. Mutation of the URX-expressed neuropeptide genes
flp-19 and
flp-8 also restores CO2 avoidance to
npr-1(lf) mutants, consistent with the possibility that neuropeptide release by URX regulates CO2 response. In addition, we found that both HW and
npr-1(lf) animals avoid CO2 under low O2 conditions, when URX neurons are inactive. Our results suggest that in HW and
npr-1(lf) animals, URX neurons control CO2 response by coordinating the response to CO2 with the response to ambient O2 such that CO2 is repulsive at low ambient O2 but neutral at high ambient O2. The fact that wild C. elegans strains contain the HW allele of
npr-1 suggests that O2-dependent regulation of CO2 avoidance is likely to be an ecologically relevant mechanism by which nematodes navigate gas gradients.