The mechanisms underlying the mammalian ultradian sleep rhythm-the alternation of rapid-eye-movement (REM) and slow-wave (SW) states-are not well understood but probably depend, at least in part, on circuits in the brainstem1-6. Here, we use perturbation experiments to probe this ultradian rhythm in sleeping lizards (Pogona vitticeps)7-9 and test the hypothesis that it originates in a central pattern generator10,11-circuits that are typically susceptible to phase-dependent reset and entrainment by external stimuli12. Using light pulses, we find that Pogona's ultradian rhythm8 can be reset in a phase-dependent manner, with a critical transition from phase delay to phase advance in the middle of SW. The ultradian rhythm frequency can be decreased or increased, within limits, by entrainment with light pulses. During entrainment, Pogona REM (REMP)can be shortened but not lengthened, whereas SW can be dilated more flexibly. In awake animals, a few alternating light/dark epochs matching natural REMP and SW durations entrain a sleep-like brain rhythm, suggesting the transient activation of an ultradian rhythm generator. In sleeping animals, a light pulse delivered to a single eye causes an immediate ultradian rhythm reset, but only of the contralateral hemisphere; both sides resynchronize spontaneously, indicating that sleep is controlled by paired rhythm-generating circuits linked by functional excitation. Our results indicate that central pattern generators of a type usually known to control motor rhythms may also organize the ultradian sleep rhythm in a vertebrate.