Sleep apnea, which is the periodic cessation of breathing during sleep, is a major health problem affecting over 10 million people in the United States and is associated with several sequelae, including hypertension and stroke. Clinical studies suggest that abnormal carotid body (CB) activity may be a driver of sleep apnea. Because gaseous molecules are important determinants of CB activity, aberrations in their signaling could lead to sleep apnea. Here, we report that mice deficient in heme oxygenase-2 (HO-2), which generates the gaseous molecule carbon monoxide (CO), exhibit sleep apnea characterized by high apnea and hypopnea indices during rapid eye movement (REM) sleep. Similar high apnea and hypopnea indices were also noted in prehypertensive spontaneously hypertensive (SH) rats, which are known to exhibit CB hyperactivity. We identified the gaseous molecule hydrogen sulfide (H2S) as the major effector molecule driving apneas. Genetic ablation of the H2S-synthesizing enzyme cystathionine-γ-lyase (CSE) normalized breathing in HO-2-/- mice. Pharmacologic inhibition of CSE with l-propargyl glycine prevented apneas in both HO-2-/- mice and SH rats. These observations demonstrate that dysregulated CO and H2S signaling in the CB leads to apneas and suggest that CSE inhibition may be a useful therapeutic intervention for preventing CB-driven sleep apnea.