The inhibition of sensory responsivity is considered a core serotonin function, yet this hypothesis lacks direct support due to methodological obstacles. We adapted an optogenetic approach to induce acute, robust and specific firing of dorsal raphe serotonergic neurons. In vitro, the responsiveness of individual dorsal raphe serotonergic neurons to trains of light pulses varied with frequency and intensity as well as between cells, and the photostimulation protocol was therefore adjusted to maximize their overall output rate. In vivo, the photoactivation of dorsal raphe serotonergic neurons gave rise to a prominent light-evoked field response that displayed some sensitivity to a 5-HT1A agonist, consistent with autoreceptor inhibition of raphe neurons. In behaving mice, the photostimulation of dorsal raphe serotonergic neurons produced a rapid and reversible decrease in the animals' responses to plantar stimulation, providing a new level of evidence that serotonin gates sensory-driven responses.