There isn’t a runner on the planet who hasn’t had at least occasional trouble falling asleep before an important race. Just when you most need a full night’s rest, you spend the night, tossing and turning.

What can you do? And if you don’t sleep well, will it sabotage your big race?

Certainly, the quality and length we sleep has a significant impact on everything we do—especially running—but a sleepless night before your big race or even a marathon will not have a serious negative effect on the race. But how you have prepared for the race in the months of training leading up to it, may affect your sleep patterns.

First off, not sleeping well or having trouble falling asleep is hardly unusual. More than 40 million Americans have chronic sleep problems, according to the National Commission on Sleep Disorders and another 30 million have trouble getting enough rest.

But again, a poor night of sleep before a race probably won’t have a negative impact on the race. It’s actually more important to sleep soundly the week before the race and especially the second to the last night before the race, according to Dr. Timothy Noakes of South Africa, author of “The Lore of Running,” who has studied the sleep patterns of runners.

The only downside to loss of sleep the night before the race could be lack of focus or the ability to concentrate. Even so, it shouldn’t negatively effect your endurance or speed.

On the other hand, chronic sleep loss can have a greater downside, mainly in the inability to recover from a workout as well as you should. Without adequate sleep, your recovery is greatly compromised.

“Adequate” sleep means something different for everyone. Some people get by just fine on five or six hours of sleep a night, but most of us need between seven and nine hours of solid sleep a night. Somewhat surprisingly, runners don’t appear to need any more sleep than the average American.

What is not surprising, is that a moderate amount of running or even walking can actually help you get to sleep quicker and once asleep, sleep deeper. Any aerobic exercise such as swimming or cycling will have the same effect and researchers agree that people who exercise on a regular basis, usually sleep better.

But the researchers aren’t sure why exercise works. Obviously, since exercise means greater fatigue and the body has to repair itself might be the primary reason it helps. Another theory is that running raises the body temperature which may lead to a greater need for sleep. Yet another reason could be that running acts as a sedative by bathing the brain in endorphins which partially negates stress and anxiety. That’s one reason sleep doctors often prescribe exercise for insomniacs or people battling depression.

When you run, can impact your sleep. A morning run before breakfast seems to have little negative impact on that night’s sleep, but going for an evening run can get in the way of that night’s sleep. As running relates to sleep patterns, the best time to run is probably morning or about mid-day.

So running is a good thing if getting a good night’s sleep is a problem. But too much running can actually make it harder to fall asleep and stay asleep. Ironically, after a long run or marathon or right when you’re in the middle of a high-mileage week–when you need the most rest–the added effort can inhibit your sleep.

Anyone who has run a marathon has experienced that supreme fatigue of covering 26.2 miles and badly needing rest to recover. But, you may also have experienced extreme difficulty falling asleep that night. Your legs are beat, but your mind (and more importantly, your heart) is still racing.

Evidence shows, running over 18 or 19 miles, may make it difficult to sleep—regardless of how tired you are. This is more true for newbies than experienced runners. Because research shows that the less accustomed you are to doing long runs, usually means the greater chance it will effect your sleep.

Similarly, lack of sleep is a clear symptom of overtraining that many elite runners, covering 120 miles a week or more, experience. Former marathon world record holder Alberto Salazar had such trouble sleeping during his heyday in the early ‘80s that he checked into a sleep clinic for a cure. His inability to sleep was a clear symptom of overtraining, but what Salazar also found at the sleep clinic was that he was sleeping a lot more than he though–but just didn’t know he was sleeping. He thought he was tossing and turning all night, but was actually asleep most of the time.

This is also quite common. We mistakenly believe we haven’t slept a wink, but have been sleeping. It just wasn’t as restful or deep as we like.

But lack of sleep as it relates to overtraining doesn’t just bother elite runners. Beginners also complain about a lack of sleep when they boost their training mileage or long runs. It takes the body time to adjust to any new training level, but it usually compensates after just a few days.

If you are having trouble sleeping, you can always run easier for a few days and give your body a chance to catch up on sleep. Alcohol does not help. Melatonin—a hormone supplement, readily available at pharmacies and health-food stores—does. It is very mild and helps people overcome jet lag as well as minor sleep problems. It is not habit forming and there is no hangover effect such as with sleeping pills.

Here are a few sleep hints that may help you fall off easier:

1. Be consistent when you go to bed—and wake up. Don’t go to bed an hour or two early to catch up on sleep. You’ll likely just toss and turn. You can’t store sleep so don’t try.
2. Sleep in a dark, quiet environment.
3. Get away from distractions. Turn off the bedroom phone, stick noisy cats or dogs in another room and turn off all lights.
4. Put away the cell phone. Also don’t use a Nook, Kindle or tablet to read in bed. It may interfere with your sleep.
5. Don’t drink coffee, alcohol or use some non-drowzy medications before bed. Especially during cedar season.
6. Eat dinner several hours before bedtime. If you want to nibble before going to bed, try a carbohydrate-rich food which is easily digestible.
7. Don’t nap. If you’re having trouble sleeping at night, avoid taking a catnap which may delay when you’re sleepy enough to go to bed at night.
8. Don’t run or exercise close to bedtime. Give yourself at least three or four hours after you exercise before going to sleep.
9. If you can’t sleep, get up and read or watch TV. Don’t lay in bed for hours. Sleep on a different bed or couch. According to healthy sleep website your bed plays a big role when it comes down to sleeping comfortably.
10. Turn off your mind. Try not to think about stressful events or duties. You can’t do anything about them now anyway.