Mammalian sleep consists of distinct rapid eye movement (REM) and non-REM (NREM) states. The midbrain region ventrolateral periaqueductal gray (vlPAG) is known to be important for gating REM sleep, but the underlying neuronal mechanism is not well understood. Here, we show that activating vlPAG GABAergic neurons in mice suppresses the initiation and maintenance of REM sleep while consolidating NREM sleep, partly through their projection to the dorsolateral pons. Cell-type-specific recording and calcium imaging reveal that most vlPAG GABAergic neurons are strongly suppressed at REM sleep onset and activated at its termination. In addition to the rapid changes at brain state transitions, their activity decreases gradually between REM sleep and is reset by each REM episode in a duration-dependent manner, mirroring the accumulation and dissipation of REM sleep pressure. Thus, vlPAG GABAergic neurons powerfully gate REM sleep, and their firing rate modulation may contribute to the ultradian rhythm of REM/NREM alternation.