There’s no doubt about that, it’s called REM sleep, and the brain deliberately enters into that state. It’s not accidental.
Once again though, we have the problem of sleepwalking, where people can walk, operate machinery, turn on the lights because it is too dark, carry on conversations and do all sorts of things that prove that they have the ability to make sense of stimuli, including spoken and written language. Yet all this is occurring during REM sleep.
There’s been a lot of work done on this, particularly associated with sleep apnea research. The basic finding is that lack of REM sleep is almost as bad as a total lack of sleep.
The brain usually enters REM sleep after about an hour of normal sleep, so researcher can wake volunteers as soon as they start to enter REM sleep, and then let them go back to sleep.
What you find is that even though the volunteer only loses about 2 hours sleep a night, they perform as badly the following day as people who only got two hours of sleep all night. Control subjects who were woken just as frequently, but always woken *after *an REM sleep cycle, performed as well as controls who had an undisturbed 8 hours sleep.
Even more interesting is that the time delay to REM sleep declines. A normal person goes into REM after about an hour. After being deprived of the first couple of cycles the time declines to 50 minutes, then 40 etc. until after couple of days the victims start going into REM sleep almost immediately.
What this all suggests is that dreaming plays an essential role in the recuperative role of stress, and that the brain has evolved to ensure that it occurs.
The big mystery remains why we dream, or for that matter why we sleep at all. It all seems pointless form a physiological POV, yet clearly it isn’t.