It has been theorised by many sleep and dream researchers that one of the functions of sleep and dreams is memory consolidation. By this it is meant that when we are asleep and when we dream our memories are strengthened so that we can remember them in the future. It also refers to a number of other different processes that our memories undergo constantly: they need to be integrated with the memories we already have; the emotional intensity needs to be reduced (see emotion-processing); we need to be able to extract the most important information from the memory; we need to be able to create a “gist” memory of the experience; we need to be able to use the memory to make decisions about the future; and so on.
There is absolutely tonnes of evidence for that memories are consolidated in sleep. In fact we even know that different memories are consolidated by different stages of sleep. For example, episodic memories are consolidated during slow-wave sleep, whereas procedural memories are consolidated during REM sleep. The picture is less clear for dreams, but if dreams are simply the phenomenological experiences of sleep then it follows that it is also the case for dreams.