Biological homeostasis invokes modulatory responses aimed at stabilizing internal conditions. Using tunable photo- and mechano-stimulation, we identified two distinct categories of homeostatic responses during the sleep-like state of Caenorhabditis elegans (lethargus). In the presence of weak or no stimuli, extended motion caused a subsequent extension of quiescence. The neuropeptide Y receptor homolog, NPR-1, and an inhibitory neuropeptide known to activate it, FLP-18, were required for this process. In the presence of strong stimuli, the correlations between motion and quiescence were disrupted for several minutes but homeostasis manifested as an overall elevation of the time spent in quiescence. This response to strong stimuli required the function of the DAF-16/FOXO transcription factor in neurons, but not that of NPR-1. Conversely, response to weak stimuli did not require the function of DAF-16/FOXO. These findings suggest that routine homeostatic stabilization of sleep may be distinct from homeostatic compensation following a strong disturbance. DOI: http://dx.doi.org/10.7554/eLife.04380.001, eLife digest The regenerative properties of sleep are required by all animals, with even the simplest animal, the nematode Caenorhabditis elegans, displaying a sleep-like state called lethargus. During development, nematodes must pass through four larval stages en route to adulthood, and the end of each stage is preceded by a period of lethargus lasting 2 to 3 hr. Human sleep is divided into distinct stages that recur in a prescribed order throughout the night. Nematodes, on the other hand, simply experience alternating periods of activity and stillness as they sleep. Nevertheless, in both species, any disruptions to sleep automatically lead to adjustments of the rest of the sleep cycle to compensate for the disturbance and to ensure that the organism gets an adequate amount of sleep overall. To date, it has been assumed that a single mechanism is responsible for adjusting the sleep cycle after any disturbance, regardless of its severity. However, Nagy, Tramm, Sanders et al. now show that this is not the case in C. elegans. Sleeping nematodes that were lightly disturbed by exposing them to light or to vibrations—causing them to briefly increase their activity levels—compensated for the disturbance by lengthening their next inactive period. By contrast, worms that were vigorously agitated by stronger vibrations showed a different response: the alternating pattern of stillness and activity was disrupted for several minutes, followed by an overall increase in the length of time spent in the stillness phase. Experiments using genetically modified worms revealed that these two responses involve distinct molecular pathways. A signaling molecule called neuropeptide Y affects the response to minor sleep disruptions, whereas a transcription factor called DAF-16/FOXO is involved in the corresponding role after major disruptions. Given that neuropeptide Y has already been implicated in sleep regulation in humans and flies, it is not implausible that similar mechanisms may occur in response to disturbances of our own sleep. DOI: http://dx.doi.org/10.7554/eLife.04380.002