Sleep serves disparate functions, most notably neural repair, metabolite clearance and circuit reorganization, yet the relative importance of these functions remains hotly debated. Here, we create a novel mechanistic framework for understanding and predicting how sleep changes during ontogeny (why babies sleep twice as long as adults) and across phylogeny (why mice sleep roughly five times that of whales). We use this theory to quantitatively distinguish between sleep used for neural reorganization versus repair. We conduct a comprehensive, quantitative analysis of human sleep using total sleep time, cere-bral metabolic rate, brain size, synaptic density, and REM sleep (used here to also refer to Active Sleep in infants and children). Our findings reveal an abrupt transition, between 2 and 3 years of age in humans. Specifically, our results show that differences in sleep across phylogeny and during late ontogeny (after 2 or 3 years in humans) are primarily due to sleep functioning for repair or clearance, while changes in sleep during early ontogeny (before 2 -3 years in humans) primarily support neural reorganization and learning. Moreover, our analysis shows that neuroplastic reorganization occurs primarily in REM sleep but not in NREM. In accordance with the developmental role of neuroplasticity, the percent of time spent in REM sleep is independent of brain size across species but decreases dramatically as brain size grows through development. Furthermore, the ratio of NREM sleep time to awake time emerges as a new invariant across development. This developmental transition and fundamental shift across ontogeny and phylogeny suggests a complex interplay between developmental and evolutionary constraints on sleep.