Hippocampal replay during sharp-wave ripple events (SWRs) is thought to drive memory consolidation in hippocampal and cortical circuits. Changes in neocortical activity can precede SWR events, but whether and how these changes influence the content of replay remains unknown. Here we show that during sleep there is a rapid cortical–hippocampal–cortical loop of information flow around the times of SWRs. We recorded neural activity in auditory cortex (AC) and hippocampus of rats as they learned a sound-guided task and during sleep. We found that patterned activation in AC precedes and predicts the subsequent content of hippocampal activity during SWRs, while hippocampal patterns during SWRs predict subsequent AC activity. Delivering sounds during sleep biased AC activity patterns, and sound-biased AC patterns predicted subsequent hippocampal activity. These findings suggest that activation of specific cortical representations during sleep influences the identity of the memories that are consolidated into long-term stores.