Rapid eye movement (REM) sleep has been hypothesized to promote emotional resilience, but any neuronal circuits mediating this have not been identified. We find that in mice, somatostatin (Som) neurons in the entopeduncular nucleus (EPSom)/internal globus pallidus are predominantly active during REM sleep. This unique REM activity is both necessary and sufficient for maintaining normal REM sleep. Inhibiting or exciting EPSom neurons reduced or increased REM sleep duration, respectively. Activation of the sole downstream target of EPSom neurons, Vglut2 cells in the lateral habenula (LHb), increased sleep via the ventral tegmental area (VTA). A simple chemogenetic scheme to periodically inhibit the LHb over 4 days selectively removed a significant amount of cumulative REM sleep. Chronic, but not acute, REM reduction correlated with mice becoming anxious and more sensitive to aversive stimuli. Therefore, we suggest that cumulative REM sleep, in part generated by the EP → LHb → VTA circuit identified here, could contribute to stabilizing reactions to habitual aversive stimuli.