There are two mechanisms that influence sleep. One is the sleep-inducing homeostatic mechanism; it is what makes us feel sleepy, in proportion to the time we have spent awake. The homeostatic mechanism is likely a consequence of the molecular/metabolic changes in the brain that accumulate during the wake period.
The other is the alerting circadian mechanism; it operates as a function of time of day and is driven by the body’s own clock mechanism. The homeostatic drive to sleep and circadian drive to stay alert are mechanistically independent but converge functionally to produce sleep or alertness depending on which is more powerful at a given point in time.
The circadian drive probably evolved earlier during evolution – such a mechanism is seen even in the most primitive organisms, including bacteria. It is entrained to the 24-hour day-night cycle that is governed by the rotation of the earth on its axis. This entrainment allows the internal cycle to closely follow the periodicity of the 24-hour day-night cycle and thus internal metabolic processes follow a rhythm that is optimized to take advantage of solar daytime. For example, digestive and metabolic enzyme activity is timed to coincide with the time at which feeding occurs.
The homeostatic drive to sleep probably evolved much later consequent to the development of multicellularity, specifically the development of networks of neurons that were antecedents to the much more complex organ we call the brain. Neuronal networks in the brain store information acquired when awake. The bombarding of incoming information can quickly saturate and overcome these networks unless they are given some protected time when they can block incoming information and reset the networks to allow for efficient processing of incoming information in the next awake period (and at the same time allow for critical information that needs to be “remembered”, to leave “memory traces” in the network so that the information can be reused in a process of “learning”). The homeostatic drive probably evolved as a mechanism to allow these functions of sleep to take place.
Both the circadian drive to remain alert and the homeostatic drive to sleep coexist in most organisms. The two independent systems co-evolved to complement the other. The tango the two systems play may underlie one of the greatest evolutionary advantages we enjoy as a species.
As a species we enjoy the most efficient and consolidated sleep – ie. we are monophasic short-sleepers. In contrast, most apes are polyphasic – ie. they sleep through the day in multiple bursts. What makes humans monophasic sleepers? The homeostatic drive to sleep monotonically pushes us to sleep in proportion to the time we have been awake. If it had been the sole operator, we would have fallen asleep around 3 PM each day and then woken up again around 9 PM – not the most efficient way to operate, since in the darkness of the night our ancestors would have been at their least productive. This is where a tweak to the circadian rhythm kicks in. The circadian drive to stay alert peaks in the evening (when the homeostatic drive to sleep is intense). This allows us to stay awake beyond 4 PM, till about 9 PM. This evening wake zone beyond 4 PM gives us a solid 5 hours of wake time during the twilight hours. A time that would have been used by our cave-dwelling ancestors to socialize (unlike our cousins, the tree-dwelling apes, who would have been fitfully sleeping and occasionally falling off their nests from the top of trees!). Perhaps this socialization and sharing of knowledge helped kickstart us on our journey to becoming the smartest species on earth! Coincidentally, deep sleep also helps in brain development – an added bonus that would have helped our ancestors assimilate knowledge.
It may be oversimplifying things to say that sleep was the sole driver for the leap of our species into greatness. It was probably one ingredient among many that contributed to the perfect storm that resulted in the emergence of sapience.