To elucidate the mechanisms that lead to sleep-disordered breathing, we have developed a mathematical model that allows for dynamic interactions among the chemical control of respiration, changes in sleep-waking state, and changes in upper airway patency. The increase in steady-state arterial PCO2 accompanying sleep is shown to be inversely related to the ventilatory response to CO2. Chemical control of respiration becomes less stable during the light stage of sleep, despite a reduction in chemoresponsiveness, due to a concomitant increase in "plant gain" (i.e., responsiveness of blood gases to ventilatory changes). The withdrawal of the "wakefulness drive" during sleep onset represents a strong perturbation to respiratory control: higher magnitudes and rates of withdrawal of this drive favor instability. These results may account for the higher incidence of periodic breathing observed during light sleep and sleep onset. Periodic ventilation can also result from repetitive alternations between sleep onset and arousal. The potential for instability is further compounded if the possibility of upper airway occlusion is also included. In systems with high controller gains, instability is mediated primarily through chemoreflex overcompensation. However, in systems with depressed chemoresponsiveness, rapid sleep onset and large blood gas fluctuations trigger repetitive episodes of arousal and hyperpnea alternating with apneas that may or may not be obstructive. Between these extremes, more complex patterns can arise from the interaction between chemoreflex-mediated oscillations of shorter-cycle-duration (approximately 36 s) and longer-wavelength (approximately 60-80 s) state-driven oscillations.