Hacking Dreams Could Help People Heal

Stimulating the sleeping brain may ease suffering from memory loss, stroke or mental health problems

Illustration of a person's facial profile, inside the head is the same person sitting on a chair and looking into a telescope.

Tim O'Brien

It was late, and Sonia was alone in an unfamiliar town, trying to find her way home. The map showed a route through a dark forest lit by an occasional lantern. She viewed it with foreboding but, seeing other people also using this passage, took it. Walking fast, she neared a couple ahead of her—a man and a woman—who suddenly stopped, turned and grabbed her. The man covered her face with a cloth. She found herself on a stage with a ceiling spanned by a mirror. A crowd of men armed with guns and knives encircled her; she was about to be tortured and killed. Sonia picked up a stone and threw it at the ceiling, which shattered. Pieces of glass rained down, piercing her shoulder and foot. She fled into the forest, pursued by the couple, who could read each other's minds. The woman saw where Sonia was running and informed the man—Sonia knew she would be hunted down.

This nightmare and similar ones disturbed Sonia's sleep about twice a week for months. (Her real name has been withheld for privacy.) Those awful nights left her sleepy, irritable and emotionally spent—symptoms of nightmare disorder. The condition can occur by itself or alongside deeper issues such as post-traumatic stress or anxiety disorders. Sleep specialists at the Geneva University Hospitals prescribed “imagery rehearsal” therapy. Sonia was to create a positive ending for a bad dream and practice it daily. A fresh take on a dream tends to carry over into sleep, reducing the frequency of nightmares.

But the trick doesn't always work, so Sonia joined a study to test an embellished version of it. The trial leveraged sleep's power to fortify memories—in this instance, the new dream narrative. For five minutes each evening over two weeks, Sonia relaxed in a quiet space at home and imagined that the route through the forest led to a door that opened onto a bright, colorful field that felt safe. While she and 17 other people with nightmare disorder rehearsed their new storylines, they listened through headphones to a piano chord that was played every 10 seconds, eventually associating the sound with the narrative.


On supporting science journalism

If you're enjoying this article, consider supporting our award-winning journalism by subscribing. By purchasing a subscription you are helping to ensure the future of impactful stories about the discoveries and ideas shaping our world today.


And throughout that fortnight, they wore a sleep-engineering headband when they went to bed. The device detected when the participants entered rapid eye movement (REM) sleep (so named because the eyes dart from side to side during this phase), when people experience their most vivid dreams. While they dreamed, the headband transmitted, through the bones of their skull, the same piano chord they had heard while awake.

During sleep the brain replays select memories from the day to emblazon them into its neurons. Experts call this process memory consolidation. In the nightmare study, the chord reminded the participants of their happier dreams. “We want to enhance this specific memory,” says psychiatrist Lampros Perogamvros of the University of Geneva, who led the research.

The association led people to experience fewer nightmares and more positive dreams overall. “Even if you work with only one scenario when you're awake, nightmares about any kind of theme [such as being chased] go down,” Perogamvros says. The effect was significantly stronger for those who heard the chord while rehearsing their revised dream than for those who had not, the researchers reported in 2022. Sonia, for one, stopped having nightmares altogether, and her mood improved.

Manipulating sleep might be a new route out of the proverbial forest—whether the affliction is nightmares or a problem with mood, memory or even motor skills. “Sleep is an unguarded time. It's a time when our executive control, our rational thinking, our logical decision-making, our impulse control are turned off. So stimuli that manage to get in are processed differently and possibly more effectively,” says Robert Stickgold, a cognitive neuroscientist at Harvard Medical School.

The techniques investigators use to “get in” while someone is asleep range from electrically stimulating the patient's brain to exposing them to sounds or smells that remind them of specific facts or experiences. Many of these techniques were devised to decode sleep's role in memory and cognition. But they also offer ways to speed recovery from stroke or to restore memories lost with age. They might even be able to tamp down negative emotions attached to specific memories, which could help ease post-traumatic stress, anxiety, depression, or other mental health conditions.

“One of my latest hopes is that we can have new methods to help people wake up on the right side of the bed,” says Ken Paller, a memory and sleep researcher at Northwestern University. To make such methods practical and widespread, researchers are developing a range of sleep-engineering devices people can use at home. Experts say clinical use of some of the devices is years away, and they also warn of potential risks.

Messing with memory could have unforeseen consequences, such as creating imbalances that impede learning, says neuroscientist Gina Poe of the University of California, Los Angeles. “It's kind of a scary time,” Poe says. “We don't know enough. It's kind of like [being] a toddler. We can walk but don't know where we are going or how to avoid danger.”

Scholars have suspected that sleep shores up memories for millennia. In the first century C.E., Roman writer and teacher Marcus Fabius Quintillian wrote “that the interval of a single night will greatly increase the strength of the memory.” The details of this process remained obscure until the 20th century, when the invention of the electroencephalogram, a recording of brain activity made by an array of probes placed on the scalp, spawned studies showing that the sleeping brain whirs to its own electrical rhythms.

People sleep in cycles that repeat roughly every 90 minutes and usually go through a total of four to six cycles over a full night's sleep. The first cycle starts with a period of light sleep, which has two distinct stages. During the second stage, neurons produce clusters of electrical signals called sleep spindles—evidently because when drawn as a graph of voltage changing with time, they reminded scientists of wool wound on a stick. Light sleep descends into deep “slow wave” sleep, in which the spindles continue while slow, rhythmic pulses of electrical excitation sweep across the brain, overlaid with bursts of high-frequency “ripples.” In REM sleep, the fourth stage, brain neurons fire as actively and randomly as they do during the day, and people experience emotionally charged and bizarre dreams.

Some of this sleep-time brain activity, researchers surmised, might serve memory. In the 1970s David Marr, a computational neuroscientist then at Trinity College Cambridge, floated a theory of how the brain integrates new information with existing knowledge. In this model, the hippocampus, a seahorse-shaped structure located in both hemispheres of the brain, stores information during the day. But the memory traces remain fragile until sleep, when they are reinforced and relayed to the brain's cerebral cortex, or outer layer, for long-term storage and integration with other memories.

In a landmark 1994 study, investigators took brain recordings that showed the hippocampus fortifying memories during slow-wave sleep by retracing them. As a rat navigated a maze during its waking hours, patterns of activity among neurons in its hippocampus specified the rat's whereabouts on its trek. While the rat slept, researchers recorded its brain activity again and found the same neural patterns—as if the brain were rehearsing the path through the maze to commit it to memory. A decade later scientists obtained evidence of replay in people by using positron-emission tomography, which detects blood flow as a proxy of neuronal activity. Areas of the brain that became active when people learned routes in a virtual town were reactivated during deep sleep—and the amount of activity correlated with a person's ability to remember the routes.

As Marr had predicted, the replay of memories in the hippocampus is key to consolidation. It seems to flag certain memories for safekeeping, allowing the rest of daily life to fall by the wayside. “You went grocery shopping, and they were out of the little tomatoes ... you don't want to keep that memory for the rest of your life,” Stickgold says. “So almost everything gets forgotten. The game of sleep is to figure out what you don't want to forget.”

By the early 2000s scientists knew that most of the high-voltage waves of deep sleep originate in the brain's decision-making center, the prefrontal cortex, and move as smoothly and regularly as waves in a calm sea from the front to the back of the brain. And studies in animals and in people with epilepsy (in particular, individuals who had electrodes implanted in their brains to detect seizures) had implicated other sleep-time rhythms in memory processes. These include the ripples of electrical activity from the hippocampus that probably reflect replay—and which coincide with the troughs of sleep spindles originating in the thalamus. When a person is awake, this relay station sends selected information from the senses to the cerebral cortex for interpretation, but when someone is asleep, it shuts most signals out so the person remains generally unaware of their surroundings. Intriguingly, the number of sleep spindles per minute correlates with the person's ability to learn, according to Poe.

In a further, striking coincidence—or more likely not a coincidence at all but something integral to a process of nightly information transfer perfected by evolution—both the ripples and the spindles rise and fall with the slow waves. “There's this three-part symphony,” Stickgold says. “The hippocampus and the thalamus and the cortex all work in unison to strengthen specific memories.”

Still, the evidence that the sleeping brain analyzes and integrates memory remained circumstantial until experimenters found ways to influence the process. “Can we manipulate the waves?” wondered Jan Born, a behavioral neuroscientist now at the University of Tübingen. He and his team at the University of Lübeck applied oscillating current through the scalp of sleeping subjects to increase the amplitude of slow waves. The manipulation enhanced memory, they reported in a 2006 publication. But the electrical field seemed to vary unpredictably across the brain's anatomical folds. So the team switched to sound, which would be processed more reliably, Born felt, through a biological channel: the ear.

The researchers played soft clicks to sleepers timed to the up phase of their slow waves. The stimulation, given for a single night, greatly enhanced the size and duration of the slow waves and the spindles. Critically, compared with their performance after sleep alone, the intervention improved participants' memory of 120 word pairs, the team reported in 2013. The work directly tied the oscillations of slow-wave sleep to memory—and pointed to a way of using slow-wave sleep to improve memory.

“That's a sleep-engineering idea: Can we make that physiology run its course more effectively? Or, if it's not quite working well, can we adjust it so that it works better?” Paller asks. Slow waves weaken with age, which might explain age-related memory problems. Would supplementing slow waves mitigate memory decline? Northwestern neurologists Roneil Malkani and Phyllis Zee, in collaboration with Paller, among others, successfully used sound to enhance the ability to recall word pairs in five of nine people with mild cognitive impairment.

These interventions lasted just one night, however. In practice, staving off memory decline most likely requires longer-term treatment. Stimulating the brain during sleep through surgically implanted electrodes could theoretically shore up memory on a consistent basis. Neurosurgeon Itzhak Fried of U.C.L.A. Health and his colleagues recently showed that they could use such deep-brain stimulation to enhance memory. Fried had implanted the electrodes to detect seizures in people with severe epilepsy. But when these patients were asleep and seizure-free, he used the electrodes to sense and alter their deep-sleep oscillations.

As a slow wave was on the upswing, one of the electrodes sent a pulse of electricity to boost “the triple coincidence of ripples, spindles and slow waves,” Fried says. All six individuals who received this stimulation in the prefrontal cortex showed better recall of pairs of pictures after the night the electrode was live compared with their memory after undisturbed sleep, the scientists reported in 2023. The degree of memory improvement correlated with the shift in the brain's electrical patterns.

“We are changing the architecture of sleep,” Fried says. “Our goal is to really try to see whether we could have a memory aid or a memory neuroprosthetic device”—akin to a cochlear implant for people with impaired hearing.

Credit: Ni-ka Ford (brain) and Jen Christiansen

In addition to improving general memory by enhancing electrical waves in the sleeping brain, scientists have found diverse ways to enhance specific memories but not others. The first attempt at this strategy involved odors. Born's team asked people to sniff a rose scent while they learned the location of objects in a grid. They then exposed some of the participants to the fragrance while they slept. When delivered during slow-wave sleep, the scent spurred the sleepers' brains to revisit what they had learned—and significantly improved their recall of the locations (compared with that by people who were not exposed to the odor during sleep or were exposed to it only during REM sleep), the researchers reported in 2007. Brain imaging revealed that the scent strongly activated the hippocampus, further indicating that the stimulus enhanced replay.

Two years later Paller and his colleagues showed that they could do something similar with sound. The researchers played unique sounds while people memorized the locations of 50 objects on a computer screen. When seeing a picture of a cat, for example, the participants heard a meow; when seeing a kettle, they heard a whistle. The scientists then played 25 of the sounds during a nap, after which people remembered the locations of the associated objects better than they remembered the others—if they heard a whistle and not a meow, they would be more accurate in recalling the kettle's location on the screen than the cat's.

Paller's method, which he termed targeted memory reactivation, or TMR, gained traction as a way to bolster specific memories. In 2022 his then graduate student Nathan Whitmore showed that TMR could improve memory for faces and names, with the strongest effects in those who had the longest and most uninterrupted slow-wave sleep. This method might help older people with memory problems remember facts important to them, such as their grandchildren's names, Paller says.

TMR can also improve procedural memory, which underlies skills ranging from playing a piano piece to perfecting a jump shot. People execute learned sequences of finger movements faster after sleeping. Performance improves further if the memory for the sequence is reactivated during slow-wave sleep—by, say, a playback of tones the person listened to while learning each finger movement.

A similar method could speed recovery from strokes that leave people unable to perform basic movements. Rehabilitation involves practicing those skills daily. “If you want to use your toothbrush or pick up the salt, you have to control some muscles selectively and not other muscles,” Paller says. To teach these kinds of skills, Northwestern neurologist Mark Slutsky developed a simple 1980s-style video game in which users must activate one or two muscles to move a cursor from the center of a screen to one of eight targets—red squares that turn green when the cursor reaches them—on the perimeter.

In a 2021 study, Paller, Slutsky and their colleagues showed that TMR can improve people's performance in this game. While aiming for each target, 20 healthy young adults heard a unique sound such as a meow, drumroll or bell. After few hours of practice, they took a 90-minute nap. When they entered slow-wave sleep, they heard some of the sounds at five-second intervals. After they awoke, they showed improved performance—in speed, efficiency and muscle selection—in navigating to the red-square targets that were linked to the sounds played during their nap. Paller, Slutsky and their colleagues are testing a similar procedure in stroke patients who have difficulty moving their arms.

Cutting-edge versions of TMR synchronize the sound cues with the slow waves. “It matters exactly when we apply these triggers,” says neuroscientist Penelope Lewis of Cardiff University in Wales. She and her colleagues find that the technique can improve the learning of relations among objects—in this case a hidden ranking in groups of six photographs—but only if the sounds denoting that relation are played back during the peak, and not the trough, of the slow wave. In a related finding, cognitive neuroscientist Bernhard Staresina of the University of Oxford and Hong-Viet V. Ngo, now at the University of Essex in England, reported improved memory for verb-picture associations when they synchronized specific sound cues to the slow wave's rise. Moreover, cueing during this phase prolonged the wave and increased the power of associated spindles.

Intervening in slow-wave sleep can also alter emotions attached to specific memories—which can potentially boost mental health. Cognitive neuroscientist Xiaoqing Hu of the University of Hong Kong and his colleagues used TMR to put a positive spin on aversive memories by building associations with upbeat words. They taught people to associate nonsense words with disturbing photographs and then, during slow-wave sleep, replayed the nonsense cues along with positive words. Afterward people were less repulsed by the cued pictures than they had been before, the researchers reported in 2023. Again, the effect was strongest when the positive words coincided with the up phase of slow oscillations.

The role of slow-wave sleep in memory consolidation is now well established, but the function of REM sleep is less clear. The dreams in this stage often seem illogical because parts of the brain's prefrontal cortex, which controls rational thought, are offline while brain regions controlling vision, movement and emotions remain active. Yet one emerging theory is that the fantastical dreams experienced during REM sleep tame emotions attached to memories and help people gain a broader understanding of what happens to them.

“REM-sleep dreaming offers a form of overnight therapy,” writes neuroscientist Matthew Walker in Why We Sleep: Unlocking the Power of Sleep and Dreams (Scribner, 2017). “[It] takes the painful sting out of difficult, even traumatic emotional episodes.” During REM sleep, levels of norepinephrine—a neurotransmitter that drives fear responses such as sweating, rapid heart rate and pupil dilation—get tamped down. As a result, memories that surface during REM sleep are divorced from those responses, Walker and others say, decoupling them from their emotional charge. (In patients with post-traumatic stress disorder, however, levels of norepinephrine remain high, and nightmares recur.)

If the theory is correct, inducing people to relive difficult experiences during REM sleep might help defuse the disturbing emotions associated with them. In a 2021 study, people rated upsetting pictures as less bothersome after associating the pictures with specific sounds and being exposed to those sounds during REM sleep. In contrast, there was no effect when the sounds were played during slow-wave sleep. If something similar works on people's real-life memories, it might be an avenue for treating depression or PTSD, according to Lewis.

REM sleep dreams might also help defuse strong emotions attached to an event through subconscious learning. Instead of dreaming about the upsetting event itself, people often dream about a more benign, related memory, leading them to subliminally connect the two experiences. Stickgold offered an example: if he were distraught after having a near-miss car accident during the day, he might dream about playing bumper cars with his son. The dream would help Stickgold realize that the car crash, if it had actually happened, “might have just meant my fender got bashed in. [But] I was reacting to it as if I had just barely stayed alive,” Stickgold speculates. “And that might have become clear to me because I had this linked memory of bumper cars where nothing bad happens.”

Credit: Blend Images/Inti St Clair/Getty Images (child); sarayut Thaneerat/Getty Images (sunset)

In this way, REM sleep dreams can provide perspective. “You have to let the brain build this dream narrative to evaluate the emotional response to it,” Stickgold says. TMR could be used to shape that narrative, and the nightmare-disorder study in Geneva highlighted the possibility of such interventions. It could also make traditional forms of psychotherapy more effective. “Any psychotherapeutic approach aims at a change in behavior, habits, thoughts. Psychotherapy is therefore a form of learning,” says neuroscientist Sophie Schwartz of the University of Geneva, first author of the nightmare-disorder study. “Using TMR, we can boost such learning.”

Most sleep-engineering studies require patients or volunteers to come into a laboratory or other institutional setting, which limits the scope and efficacy of the intervention. People don't want to sleep in a lab for more than a night or two. But “if the technology were wearable and portable, it could plausibly be embedded in somebody's life,” says Heidi Johansen-Berg, a cognitive neuroscientist at Oxford. “So even if the benefit of any single day is quite small, you could imagine those incremental benefits building up significantly over time.”

Commercial devices that can be used at home are likely to be an important gateway to enhanced healing during sleep. One such invention, currently being tested for its ability to burnish verbal memory and to speed stroke recovery, involves a smartwatch that collects movement and data on heart rate, as well as a smartphone that plays sounds. A machine-learning model identifies periods of deep sleep and triggers TMR sounds within these periods. In research published in 2022, Whitmore and others found that using this technology at home for three nights improved people's memory for object locations—as long as the sounds were played softly enough that they did not disturb the sleeper.

For debilitating nightmares, doctors can already prescribe a phone app that uses artificial intelligence to analyze biometric data from Apple Watch sensors. When the sensors detect the rising heart rate and restlessness associated with a nightmare, the watch delivers intermittent gentle vibrations to disrupt the dream without waking the sleeper. Data published in 2023 from a trial of 65 veterans with trauma-induced nightmares suggest the device, when worn at least half the time, significantly enhanced sleep quality, as reported by the veterans.

A glovelike sleep detector developed by Adam Haar Horowitz, then at the Massachusetts Institute of Technology, and his colleagues might also reduce nightmares. The device monitors biological signs of sleep onset through contacts on the wrist and hand. It also connects to an app that gives voice prompts such as “tree” that, in a recent study, made nappers dream about trees and enhanced their creativity on tasks related to trees.

Despite the promise of sleep engineering, experts warn of risks inherent in tampering with memories. “You are biasing which ones are preferentially strengthened in the brain,” Lewis says. If you start doing it every night, who knows what kinds of imbalances that might cause?” It is also possible that these interventions could disrupt sleep. In another of Whitmore and Paller's experiments, for example, when the sounds were played too loudly, memory actually worsened. “There are lots of things still to understand about this before we would be ready to recommend it to the general population,” Lewis says.

Meanwhile the experiments have deepened scientists' understanding of sleep's role in memory and emotion—and how it shapes people's outlook on the world and themselves. “That is what the night is for,” Stickgold says. “It's to take all the information that came during the day and integrate it with all the information we already have in a way that helps you build that story of how the world works and what your life means.”

For Sonia, at least, the targeted memory reactivation has ended her nighttime siege in the forest. Instead one night she dreamed of being invited to a party in a chalet. “There was a terrace which gave a view of the mountains,” she wrote in her dream diary. “We all went out to watch the sunset. The sky was dark pink, the weather was very beautiful. All of a sudden, I feel a hand on my waist ... This person took my hand and took me to the center of the terrace, we started dancing without music. It was like in the movies, the world around began to spin quickly, I felt butterflies in my stomach for the first time in my life.”