The neural mechanisms that balance waking and sleep to ensure adequate sleep quality in mammals are highly complex, often eluding functional insight. In the last two decades, researchers made impressive progress in studying the less complex brain of the invertebrate model organism Drosophila melanogaster , which has led to a deeper understanding of the neural principles of sleep regulation. Here, we will review these findings to illustrate that neural networks require sleep to undergo synaptic reorganization that allows for the incorporation of experiences made during the waking hours. Sleep need, therefore, can arise as a consequence of sensory processing, often signalized by neural networks as they synchronize their electrical patterns to generate slow-wave activity. The slow-wave activity provides the neurophysiological basis to establish a sensory gate that suppresses sensory processing to provide a resting phase which promotes synaptic rescaling and clearance of metabolites from the brain. Moreover, we demonstrate how neural networks for homeostatic and circadian sleep regulation interact to consolidate sleep into a specific daily period. We particularly highlight that the basic functions and physiological principles of sleep are highly conserved throughout the phylogenetic spectrum, allowing us to identify the functional components and neural interactions that construct the neural architecture of sleep regulation.