Animals consolidate some, but not all, learning experiences into long-term memory. Across the animal kingdom, sleep has been found to have a beneficial effect on the consolidation of recently formed memories into long-term storage. However, the underlying mechanisms of sleep dependent memory consolidation are poorly understood. Here, we show that consolidation of courtship long-term memory in Drosophila is mediated by reactivation during sleep of dopaminergic neurons that were earlier involved in memory acquisition. We identify specific fan-shaped body neurons that induce sleep after the learning experience and activate dopaminergic neurons for memory consolidation. Thus, we provide a direct link between sleep, neuronal reactivation of dopaminergic neurons, and memory consolidation.