Over the years, I've read a lot of good advice on how to get a good night's sleep. Set a regular schedule; make sure you're getting a full eight hours; don't drink alcohol to help you settle down; things like that. So, for your edification, here is my advice on the topic:
1. No matter how desperate you are to find time for writing, don't stay up until midnight if you're not making any notable progress. (Admittedly, I remember when midnight was positively early, but I'm not that young anymore.)
2. Do not wake up from a terrible nightmare at, say, two o'clock in the morning. Especially one in which you've discovered that two of your fellow colonist/explorers who have been missing for weeks have apparently been being horribly tortured the whole time, after which you find yourself being chased by a corrupted toddler-thing that wants to get to your spaceship so it can leave the planet and spread its evil across the Universe - before you can get to your spaceship and escape. Above all, once you wake up shivering, do not lay there wondering if the toddler-thing is going to put its horrible, clammy hands in the center of your back.
3. Do not be awakened (at, say, four in the morning) by a six-year-old with a horrible, gunky, rasping cough. If that does happen, and you do get up to medicate him, do not discover in the process that he's wet the bed and will require an additional few minutes to use the restroom and change clothes while you try to scrounge up some fresh, dry bedding. In fact, if you can avoid having a sick child in the first place, that's really the recommended course of action.
4. Do not own cats. Ever. Especially not fat, elderly cats who firmly believe that their single most important contribution to the household is to serve as premature alarm clocks and ensure that everyone wakes up a good five or ten minutes before their perfectly-reliable electronic alarm clocks go off.