Memory consolidation is a process in which newly acquired information is transformed into long-term memory. Consolidation of explicit memory requires the hippocampus, which generates a sharp-wave associated fast field-oscillation (200 Hz), referred to as ripples6,7. Hippocampal ripples, which predominantly occur during slow-wave sleep, have been shown to play an essential role in memory consolidation. However, little is known about how ripples are regulated by other brain regions. Here we show that the median raphe nucleus plays a key role in regulating hippocampal ripple activity and memory consolidation. We performed in vivo simultaneous recordings in the median raphe nucleus and hippocampus, and found that when a group of raphe neurons were active, ripples were absent. To determine a causal relationship, we employed an optogenetic approach and found that photostimulation of median raphe neurons suppressed hippocampal ripple activity, while photoinhibition of these neurons increased hippocampal ripple activity. Importantly, by using a fear conditioning procedure, we provide evidence that photostimulation of median raphe neurons interferes with memory consolidation. In conclusion, our results demonstrate a critical role of the median raphe nucleus in regulating hippocampal ripple activity and memory consolidation, and identify a new brain circuitry that controls these physiological learning and memory processes.