Carl Sagan said this quote

This looks very much as if the integration of the day's experience into our memory, the forging of new neural links, is either an easier or a more urgent task. As the night wears on and this function is completed, the more affecting dreams, the more bizarrematerial, the fears and lusts and other powerful emotions of thedream material emerge.