A famous sleep biologist once noted, “If sleep does not serve an absolute vital function, then it is the biggest mistake the evolutionary process ever made.” Indeed, over evolutionary time, sleep has become integrated with almost every dimension of biological function in mammals, including growth, cognition, immunity, and metabolism. Research across mammalian species has revealed how ecological factors, including sociality and predation, influence sleep characteristics. More recently, we have documented how many of these same selective forces have shaped the evolution of human sleep relative to other primates, resulting in a marked decline in total sleep time and an increase in the proportion of REM sleep along the human lineage. I will present these evolutionary findings and discuss the follow-up research we have conducted in Madagascar and Tanzania to better understand the ecology of human sleep. Collectively, our findings suggest that risks and opportunity costs have shaped human sleep in terms of duration, quality, and social patterning. Perceptions of threat in our increasingly urban and stressful world are likely triggering many of these same effects, potentially leading to sleep disparities that drive health disparities in marginalized populations.