During the night, your brain goes through four to six cycles called sleep stages. In each cycle there are periods of NREM sleep followed by brief intervals of REM sleep. It is during the REM sleep that your brain actively dreams. Each of these cycles lasts approximately 90 minutes. As morning approaches, the NREM periods become shorter and the REM becomes longer.
Therefore, as you get closer to morning, your chance of experiencing dream sleep, or REM, increases. It is during interrupted REM that you are more likely to remember your dreams. Moreover, your sleep drive, or desire to sleep, lessens the longer you sleep. Therefore, you are more likely to be restless and awaken as the morning approaches, thus increasing the chance you will interrupt these increasingly prolonged REM periods. As a result of these factors in combination, you are much more likely to remember your dreams right before you get up in the morning.

