Immediately before you go to bed, drink a full glass of water. Keep a notepad in the bathroom if possible. This has also shown itself to be an absurdly simple (yet effective) remedy for sleep paralysis and "night terrors," to which effect a banishing ritual or protective prayer may be added.