In Chapter 3 of his book Why We Sleep: Unlocking the Power of Sleep and Dreams, Matthew Walker explains "time dilation in dreams":
One last temporal distortion deserves mention here—that of time dilation in dreams, beyond sleep itself. Time isn't quite time within dreams. It is most often elongated. Consider the last time you hit the snooze button on your alarm, having been woken from a dream. Mercifully, you are giving yourself another delicious five minutes of sleep. You go right back to dreaming. After the allotted five minutes, your alarm clock faithfully sounds again, yet that's not what it felt like to you. During those five minutes of actual time, you may have felt like you were dreaming for an hour, perhaps more. Unlike the phase of sleep where you are not dreaming, wherein you lose all awareness of time, in dreams, you continue to have a sense of time. It's simply not particularly accurate—more often than not dream time is stretched out and prolonged relative to real time.
Although the reasons for such time dilation are not fully understood, recent experimental recordings of brain cells in rats give tantalizing clues. In the experiment, rats were allowed to run around a maze. As the rats learned the spatial layout, the researchers recorded signature patterns of brain-cell firing. The scientists did not stop recording from these memory-imprinting cells when the rats subsequently fell asleep. They continued to eavesdrop on the brain during the different stages of slumber, including rapid eye movement (REM) sleep, the stage in which humans principally dream.
The first striking result was that the signature pattern of brain-cell firing that occurred as the rats were learning the maze subsequently reappeared during sleep, over and over again. That is, memories were being “replayed” at the level of brain-cell activity as the rats snoozed. The second, more striking finding was the speed of replay. During REM sleep, the memories were being replayed far more slowly: at just half or quarter the speed of that measured when the rats were awake and learning the maze. This slow neural recounting of the day's events is the best evidence we have to date explaining our own protracted experience of time in human REM sleep. This dramatic deceleration of neural time may be the reason we believe our dream life lasts far longer than our alarm clocks otherwise assert.
If memories replay slower, then wouldn't that make dreams feel shorter (not longer)? Yohan John writes on Quora that "replays are typically much faster than actual experience." Now, that would make sense to me.