Insight denotes a mental restructuring that leads to a sudden gain of explicit knowledge allowing qualitatively changed behaviour1, 2. Anecdotal reports on scientific discovery suggest that pivotal insights can be gained through sleep3. Sleep consolidates recent memories4, 5, 6 and, concomitantly, could allow insight by changing their representational structure. Here we show a facilitating role of sleep in a process of insight. Subjects performed a cognitive task requiring the learning of stimulus–response sequences, in which they improved gradually by increasing response speed across task blocks. However, they could also improve abruptly after gaining insight into a hidden abstract rule underlying all sequences. Initial training establishing a task representation was followed by 8 h of nocturnal sleep, nocturnal wakefulness, or daytime wakefulness. At subsequent retesting, more than twice as many subjects gained insight into the hidden rule after sleep as after wakefulness, regardless of time of day. Sleep did not enhance insight in the absence of initial training. A characteristic antecedent of sleep-related insight was revealed in a slowing of reaction times across sleep. We conclude that sleep, by restructuring new memory representations, facilitates extraction of explicit knowledge and insightful behaviour.