A good brain never sleeps.

In fact, it stays up all night to crunch the data we collect by day. And considering all that information — the countless experiences and feelings and sensations of daily life — you might imagine things get a little wild in there.

And so too do our dreams.

That’s because the brain processes that data visually and emotionally even as the resulting dreams make no sense to the conscious mind.

Think of it like shift work; you consciously experience the day and all the myriad data that cascades through you at every moment. And for the night shift, in comes the mad librarian, shelving what’s deemed useful and chucking the rest. No wonder it looks like unicorns and two-headed babies and even the bogeyman.

It’s a lot of data — it’s almost unfathomable to take stock of every sensation you had in every moment of consciousness. But your brain is a master mega-processor, even if you’re sure — with those freaky David Lynch dreamscapes — it’s gone off the deep end.

In fact, as Robert Stickgold of Harvard Medical School tells NBC BETTER, "the brain is trying to solve problems and complete processes that were going on during waking that it — in its waking hours — didn't complete."

Of course there are plenty more possible reasons why we dream, including some very dark ones, like looming mental health issues.

But we know that most people who talk and walk in their sleep aren’t abnormal or dangerous. They’re more likely just acting out the impulses of a very busy brain. Essentially, sleepwalking happens when the brain forgets to shut down the safety switch at night, enabling physical movements in response to the dream world.

A child walking a tightrope with the moon in the background. We may act out our dreams because the brain neglected to block our physical responses to stimuli. (Photo: Sergey Nivens/Shutterstock)

Being aware of the brain’s nightly labors, even if they seem like the most bizarre of reveries, is part of the process of assigning meaning to information gathered by day.

You need that midnight oil-burning brain to sort through it all, catalog what’s important, and shred the ephemera. If not for sleep, and the dreams it brings, you could be bombarded with all the data in the world — and not keep a lick of it.

A sleep-deprived — or we should say dream-deprived — human is a zombie. All the motions. None of the cognition.

And, as recent research points out, it’s not all about REM sleep, a state many assume to be a prerequisite for dreaming. Instead it’s likely we dream even outside of the REM phase.

That's a good thing because we need all the dreams we can get to help us navigate this puzzle we call life. As wild and woolly as they may seem, dreams are based on real events experienced while awake. When we dream, we gain a conscious window into the brain's efforts to bring order to the data chaos. And in that effort, we may find a solution to something that's been perplexing us — and wake up the next day unexpectedly equipped to handle that problem.

Man with briefcase standing before dreamy city. Ever wake up instinctively knowing how to handle yesterday's problem? Your mind may have worked it out through dreams. (Photo: Sergey Nivens/Shutterstock)

Consider, for example, a 2010 Harvard University experiment that presented 99 subjects with a labyrinth puzzle. Part of that group was allowed to break for a nap. Those subjects came back to the puzzle re-invigorated — and those who reported dreaming during their nap excelled at the puzzle.

The group who weren’t allowed a nap? Not so much.

It seems that even in writing this story, taking a break to get a little sleep would result in a far more cogent and structured final product.

And maybe that's just what this writer did — but he'll never tell.

In any case, spending the night with leprechauns and centaurs dancing in our heads can do us all a world of good.

Keep that in mind the next time you fall asleep. And party on, dear brain — just be sure to thank the librarian in the morning.

Maybe those dreams you've been having aren't so far out after all
Wild and woolly dreams may be the brain’s of looking at problems from a fresh angle.