Sleep is broadly considered a biological necessity in virtually all animals. The large majority of such taxa with documented sleep physiology are bilaterians, though there is increasing evidence of sleep or sleep-like states in non-bilaterians such as Cassiopea jellyfish and hydra (both cnidarians), and sponges. The various criteria which biologists use to define sleep states have been observed in all other animal phyla, often with profound variation in function. In all of these taxa except sponges, regulation of sleep is documented to involve genes whose transcription oscillates with time, known as circadian or clock genes. These genes and the gene networks they regulate give rise to the internal circadian clock. The three categories of biological sleep schedules are diurnal, nocturnal, and crepuscular which characterize species whose waking periods mostly overlap with day, night, and twilight respectively. Specific sleep patterns and durations vary widely among and sometimes within sleeping species, with some sleeping or foregoing sleep for extended periods. Others, such as some porpoises, engage in unihemispheric sleep where only one brain hemisphere sleeps at a time in order to maintain motion or homeostasis in marine environments.

The presence of some version of sleep physiology is nearly universally conserved within animals, suggesting a very ancient evolutionary origin. Chronobiological mechanisms more broadly (i.e. non-sleep biological processes which oscillate at various periods) are documented among many microbes and thus are likely much older, reflecting the day-night cycle as perhaps one of the earliest environmental stimuli used for the regulation of genes. This has led some evolutionary biologists to suggest that time-based oscillations in activity are a possible form of ancient, time-based niche partitioning to minimize competition during the same portions of the day.

Definition

Sleep can follow a physiological or behavioral definition. In the physiological sense, sleep is a state characterized by reversible unconsciousness, special brainwave patterns, sporadic eye movement, loss of muscle tone (possibly with some exceptions; see below regarding the sleep of birds and of aquatic mammals), and a compensatory increase following deprivation of the state, this last known as sleep homeostasis (i.e., the longer a waking state lasts, the greater the intensity and duration of the sleep state thereafter). In the behavioral sense, sleep is characterized by minimal movement, non-responsiveness to external stimuli (i.e. increased sensory threshold), the adoption of a typical posture, and the occupation of a sheltered site, all of which is usually repeated on a 24-hour basis. The physiological definition applies well to birds and mammals, but in other animals whose brains are not as complex, the behavioral definition is more often used. In very simple animals, behavioral definitions of sleep are the only ones possible, and even then the behavioral repertoire of the animal may not be extensive enough to allow distinction between sleep and wakefulness. Sleep is quickly reversible, as opposed to hibernation or coma, and sleep deprivation is followed by longer or deeper rebound sleep.

Necessity To show the necessity of sleep, one study argues that if sleep were not essential, one would expect to find Animal species that do not sleep at all Animals that do not need recovery sleep after staying awake longer than usual Animals that suffer no serious consequences as a result of lack of sleep

These symptoms are not seen in complex animals, and sleep is thus considered necessary to them. Sleep helps the body and mind to feel rested. Findings show that if rats do not get any sleep, they die in a few weeks. Despite having enough food, their appetite tends to decrease resulting in weight loss and eventually death.

Outside of a few basal animals that have no brain or a very simple one, no animals have been found to date that satisfy any of these criteria. While some varieties of shark, such as great whites and hammerheads, must remain in motion at all times to move oxygenated water over their gills, it is possible they still sleep one cerebral hemisphere at a time as marine mammals do. However, it remains to be shown definitively whether any fish is capable of unihemispheric sleep.

Invertebrates

The fresh-water polyp Hydra vulgaris and the jellyfish Cassiopea are among the most primitive organisms in which sleep-like states have been observed. Observing sleep states in jellyfish provides evidence that sleep states do not require that an animal have a brain or central nervous system. The nematode C. elegans is another primitive organism that appears to require sleep. Here, a lethargus phase occurs in short periods preceding each moult, a fact which may indicate that sleep primitively is connected to developmental processes. The results of Raizen et al. furthermore suggest that sleep is necessary for changes in the neural system.

Decades of research show that insects do sleep, and that this resembles mammalian and avian sleep. Nonetheless, sleep scientists continued to not accept these results and there was wide agreement that insects did not experience sleep. It took the gene expression studies showing shared lethargy-related orthology between mammals and the fruit fly Drosophila melanogaster for a conclusive understanding of sleep to be accepted.

The electrophysiological study of sleep in small invertebrates is complicated. Insects go through circadian rhythms of activity and passivity, but some do not seem to have a homeostatic sleep need. Insects do not seem to exhibit REM sleep. However, fruit flies appear to sleep, and systematic disturbance of that state leads to cognitive disabilities.

There are several methods of measuring cognitive functions in fruit flies. A common method is to let the flies choose whether they want to fly through a tunnel that leads to a light source, or through a dark tunnel. Normally, flies are attracted to light. But if sugar is placed in the end of the dark tunnel, and something the flies dislike is placed in the end of the light tunnel, the flies will eventually learn to fly towards darkness rather than light. Flies deprived of sleep require a longer time to learn this and also forget it more quickly.

If an arthropod is experimentally kept awake longer than it is used to, then its coming rest period will be prolonged. In cockroaches, that rest period is characterized by the antennae being folded down and by a decreased sensitivity to external stimuli. Sleep has been described in crayfish, too, characterized by passivity and increased thresholds for sensory stimuli as well as changes in the EEG pattern, markedly differing from the patterns found in crayfish when they are awake.

Bees have some of the most complex sleep states amongst insects. In honeybees, it has been shown that they use sleep to store long-term memories. Sleep-like state has been described in jumping spiders too, as well as regularly occurring bouts of retinal movements that suggest an REM sleep–like state. Also sleeping cuttlefish and octopuses show signs of having REM-sleep behaviors.

It is suggested that octopus also has a two-staged sleep, similar to the REM and NREM stages observed in many vertebrates. "Quiet sleep" stage usually involves behaviors such as eyes closing, flat body posture, and white-skin pattern. This stage usually lasts around 60 minutes. After the "quiet stage", the octopus moves onto an "active sleep" stage which lasts about 1 minute. In the "active sleep" stage, octopus has more eye and body movements as well as increased breathing rate. Although the octopus is suggested to have the most obvious color changing during the "active sleep" stage, a very brief and fast "color-flash" has been observed during the "quiet sleep" stage as well.

Fish

Sleep in fish is the subject of ongoing scientific research.Reebs, S. (1992) Sleep, inactivity and circadian rhythms in fish. pp. 127–135 in: Ali, M.A. (ed.), Rhythms in Fish, New York: Plenum Press. Typically fish exhibit periods of inactivity, but show no significant reactions to deprivation of this condition. Some species that always live in shoals or that swim continuously (because of a need for ram ventilation of the gills, for example) are suspected never to sleep. There is also doubt about certain blind species that live in caves.

Other fish seem to sleep, however. For example, zebrafish,; third party discussion of Yokogawa: tilapia, tench, brown bullhead, and swell shark become motionless and unresponsive at night (or by day, in the case of the swell shark); Spanish hogfish and blue-headed wrasse can even be lifted by hand all the way to the surface without evoking a response.Tauber, E.S., 1974, The phylogeny of sleep, pp. 133–172 in: Advances in sleep research, vol. 1 (E.D. Weitzman, ed.), Spectrum Publications, New York. Studies show that some fish (for example rays and sharks) have unihemispheric sleep, which means they put half their brain to sleep while the other half still remains active and they swim while they are sleeping. A 1961 observational study of approximately 200 species in European public aquaria reported many cases of apparent sleep. On the other hand, sleep patterns are easily disrupted and may even disappear during periods of migration, spawning, and parental care.

Land vertebrates Mammals, birds and reptiles evolved from amniote ancestors, the first vertebrates with life cycles independent of water. The fact that birds and mammals are the only known animals to exhibit REM and NREM sleep indicates a common trait before divergence. However, recent evidence of REM-like sleep in fish suggests this divergence may have occurred much earlier than previously thought. Up to this point, reptiles were considered the most logical group to investigate the origins of sleep. Daytime activity in reptiles alternates between basking and short bouts of active behavior, which has significant neurological and physiological similarities to sleep states in mammals. It is proposed that REM sleep evolved from short bouts of motor activity in reptiles, while slow-wave sleep (SWS) evolved from their basking state, which shows similar slow-wave EEG patterns.

Reptiles and amphibians Reptiles have quiescent periods similar to mammalian sleep, and a decrease in electrical activity in the brain has been registered when the animals have been asleep. However, the EEG pattern in reptilian sleep differs from what is seen in mammals and other animals. In reptiles, sleep time increases following sleep deprivation, and stronger stimuli are needed to awaken the animals when they have been deprived of sleep as compared to when they have slept normally. This suggests that the sleep which follows deprivation is compensatorily deeper.

In 2016, a study reported the existence of REM- and NREM-like sleep stages in the Central bearded dragon (Pogona vitticeps). Amphibians have periods of inactivity but show high vigilance (receptivity to potentially threatening stimuli) in this state.

Like some birds and aquatic mammals, crocodilians are also capable of unihemispheric sleep.Scientists find that crocodiles do, indeed, sleep with one eye open

Birds

There are significant similarities between sleep in birds and sleep in mammals, which is one of the reasons for the idea that sleep in higher animals with its division into REM and NREM sleep has evolved together with warm-bloodedness. Birds compensate for sleep loss in a manner similar to mammals, by deeper or more intense slow-wave sleep (SWS).