If you're losing sleep because you can't stop thinking about something, here's a disarmingly simple tip from Chris Guillebeau, author of The Art of Non-Conformity and The $100 Startup.
I kept waking up at night with more ideas. If I didn’t write them down, I couldn’t get back to sleep. I learned a while back that when you wake up feeling excited about an idea and can’t shake it, there’s usually a reason for it. It’s a good idea to pay attention to what you’re being told by the universe.
On a slight tangent, I believe there's an interesting parallel here with lucid dreaming.
Why?
In short: because keeping a dream journal is one of the most cited methods of improving your recall of REM sleep (the still-mysterious phase of reduced consciousness when dreams happen).
During REM sleep, the activity of your brain's neurons is most similar to that during waking hours, so it follows that anything which is waking you up, might be doing so for a reason.
Next time something wakes you up, try writing it down... or even drawing it, something I always do after a particularly vivid dream.
Posted to writing in 2012.