Among mammalian species, the time spent in the two main "architectural" states of sleep--slow-wave sleep (SWS) and rapid-eye-movement (REM) sleep--varies greatly. Previous comparative studies of sleep architecture found that larger mammals, those with bigger brains, and those with higher absolute basal metabolic rates (BMR) tended to engage in less SWS and REM sleep. Species experiencing a greater risk of predation also exhibited less SWS and REM sleep. In all cases, however, these studies lacked a formal phylogenetic and theoretical framework and used mainly correlational analyses. Using independent contrasts and an updated data set, we extended existing approaches with path analysis to examine the integrated influence of anatomy, physiology, and ecology on sleep architecture. Path model structure was determined by nonmutually exclusive hypotheses for the function of sleep. We found that species with higher relative BMRs engage in less SWS, whereas species with larger relative brain masses engage in more REM sleep. REM sleep was the only sleep variable strongly influenced by predation risk; mammals sleeping in riskier environments engage in less REM sleep. Overall, we found support for some hypotheses for the function of sleep, such as facilitating memory consolidation or learning, but not others, such as energy conservation.