One trick a psychologist mentioned is having a notepad near the bed and writing in it when it happens.