RESUMEN
Thus far, most hypotheses on the evolutionary origin of sleep only addressed the probable origin of its main states, REM and NREM. Our article presents the origin of the whole continuum of mammalian vigilance states including waking, sleep and hibernation and the causes of the alternation NREM-REM in a sleeping episode. We propose: (1) the active state of reptiles is a form of subcortical waking, without homology with the cortical waking of mammals; (2) reptilian waking gave origin to mammalian sleep; (3) reptilian basking behaviour evolved into NREM; (4) post-basking risk assessment behaviour, with motor suspension, head dipping movements, eye scanning and stretch attending postures, evolved into phasic REM; (5) post-basking, goal directed behaviour evolved into tonic REM and (6) nocturnal rest evolved to shallow torpor. A small number of changes from previous reptilian stages explain these transformations.