An area of the brain called the amygdala becomes active when you go through an intense emotional experience. Without sleep, the amygdala stays active, keeping your emotional reaction going. But if you sleep, the amygdala calms down and you wake up feeling better. It’s not just any sleep you need. It’s REM sleep. Researchers have demonstrated a nice connection between experiencing REM sleep after an intense emotional experience and a decrease in amygdala activity. This means that at a neurological level, REM sleep helps you deal with intense emotional experiences.
REM sleep also helps you deal with intense emotional experiences at a subjective level. The same researchers showed that if you get REM sleep, you can repeat an emotional experience, but not feel it as intensely. In other words, REM sleep seems to make us more resilient to potentially intense emotional experiences.
So where does the dreaming come in? REM sleep is when we do most of our dreaming. If REM sleep goes hand-in-hand with processing emotional experiences, then there is a good chance that dreaming is also linked to dealing with these intense emotional experiences.
 Van der Helm, E., Yao, J., Dutt, S., Rao, V., Saletin, J., & Walker, M. (2011). REM sleep de-potentiates amygdala activity to previous emotional experiences. Current Biology, 21(23), 2029-2032.