I have really bad insomnia sometimes (like, I won't sleep more than two or three hours a night for weeks). For the bad times, I take sleeping pills (but I have to be really careful and take the right brand, because one kind had the opposite effect and I was so wired I was all but bouncing off the walls for a couple of hours), but for nights when I can't sleep because my brain is whirling around too much, I have a special playlist on my computer of soothing music that I put on. It helps distract my brain because I focus on that, and then the next thing I know, I'm waking up because my alarm is going off.