Extremely simple rule: when you can't sleep, you work on your least favorite important task.<p>Doing such a task has a way of making your brain sleepy. I start the task with the anticipation of falling asleep, which makes it less unpleasant. And if I actually am super alert doing it, then I make progress.<p>So it's no lose.