Background: Extended wakefulness disrupts acquisition of short-term memories in mammals. However, the underlying molecular mechanisms triggered by extended waking and restored by sleep are unknown. Moreover, the neuronal circuits that depend on sleep for optimal learning remain unidentified. Results: Learning was evaluated with aversive phototaxic suppression. In this task, flies learn to avoid light that is paired with an aversive stimulus (quinine-humidity). We demonstrate extensive homology in sleep-deprivation-induced learning impairment between flies and humans. Both 6 hr and 12 hr of sleep deprivation are sufficient to impair learning in Canton-S (Cs) flies. Moreover, learning is impaired at the end of the normal waking day in direct correlation with time spent awake. Mechanistic studies indicate that this task requires intact mushroom bodies (MBs) and requires the dopamine D1-like receptor (dDA1). Importantly, sleep-deprivation-induced learning impairments could be rescued by targeted gene expression of the dDA1 receptor to the MBs. Conclusions: These data provide direct evidence that extended wakefulness disrupts learning in Drosophila. These results demonstrate that it is possible to prevent the effects of sleep deprivation by targeting a single neuronal structure and identify cellular and molecular targets adversely affected by extended waking in a genetically tractable model organism.