Some new research on dreaming used fMRI to see what brain areas are active during dreaming and compared it to what these same areas do during conscious thought. The idea was to predict what benefits dreams provide and perhaps why we evolved to have dreams. This Scientific American article summarizes several recent studies in this area.
One of them found increasing frontal theta activity. This is where we create memories of our personal experiences. This is probably why dreams seem like they really are happening to you, even when the dream has events that never really happened.
A second found that in the dreams we remember, there is more activity in the amygdala and hippocampus. The amygdala is used to process emotion and the hippocampus converts short term memory to long term. So dreams perhaps are used to help us remember the important events of our day, since important events usually have stronger emotions than unimportant events. It might be more important to remember the emotion associated with an event then it is to remember the details. Remembering that an experience was pleasurable, painful, frustrating, saddening, fun, or whatever is probably more important than remembering that it happened at 3:12pm or that you were wearing a yellow shirt when it happened.
A third study supported the link to emotion by finding that when people don’t get REM sleep, they have trouble processing emotions the next day. That area doesn't get its rest.