Sleepless nights can be incredibly frustrating, but there are many things you can do to help yourself fall asleep naturally—all backed by sound scientific research: According to physician and stress expert Eva Selhub, M.D., “Our [internal] clocks are actually fairly screwed up because we don’t abide by nature’s rhythms.” She explains that everything from staying up late to eating a poor diet can mess with the circadian rhythm. In order to get our best sleep, it’s important to stay in sync with the body’s natural rhythm. Selhub says, “The more regular your sleep, the better regulated your circadian rhythm will be.” If at all possible, get up and go to bed at the same time each day. Keeping a normal sleep schedule will help you stay in harmony with your body’s internal clock, encouraging your body to fall asleep naturally. Renowned integrative physician Robert Rountree, M.D., explains, “It helps the whole body calm down,” adding that magnesium, “does basically all the things you want to do to get the body ready for sleep and to help maintain sleep.” Magnesium can be found in foods like fruits, vegetables, nuts, and seeds, but for a more targeted approach, try a supplement like sleep support+. One proven way to quiet your mind and relax: meditation. A systematic review of seven meditation studies found evidence to suggest that meditation reduces sleep-interfering cognitive processes5 (like stressful thoughts) and improves sleep quality. Mindfulness meditation, in particular, is linked to better sleep quality and feeling better the following day. In a small study comparing sleep hygiene education and mindfulness meditation education, individuals who learned meditation techniques reported better sleep quality6 than those in the sleep class after six weeks. Starting a daily meditation practice can help you manage stress and fall asleep worry-free. According to the National Sleep Foundation, the best temperature for your bedroom is between 60 and 67 degrees Fahrenheit, although your personal needs may be slightly different. If you just can’t bear the thought of not using your devices near bedtime, consider wearing blue-blocking lenses9 about 90 minutes before bedtime or using an app on your device that blocks blue light. In fact, in one study participants took on average 10 minutes longer to fall asleep on nights they used an e-reader compared to nights they read a paper book. Researchers found that the e-readers suppressed melatonin production and decreased reported “sleepiness.” If you really want to use an e-reader, wear blue-light-blocking glasses9 in order to avoid the effects of blue light exposure on your sleep. Interestingly, a study of 1,788 young U.S. adults found that even social media use during the day can negatively affect sleep10. Study authors suggest this could be due to the emotionally, cognitively, and physiologically stimulating nature of social media. And certainly getting into a political argument or viewing disturbing news stories near bedtime is not a great way to wind down before bed. If you find yourself feeling stressed after checking your social media accounts, it is probably a good idea to sign off of them early in the evening and find more relaxing ways to spend your time prior to bed. One type of music that has been investigated for its effects on relaxation is meditative binaural music12. In this type of music, the listener hears two different tones, one in each ear. Classical music13 has also been found to promote relaxation. The analysis found that the ideal temperature range for a relaxing pre-bed bath or shower was 104 to 109 degrees Fahrenheit. Taking a warm bath stimulates the body’s natural temperature regulation14, supporting the circadian rhythm. If you can’t afford a professional massage, other options might be having someone in your household take a massage class or using a self-massager. To prepare yourself for sleep, it’s a good idea to turn down all lights a couple of hours before bedtime. Also, be aware that certain types of bulbs put out more blue light than others, such as LED and fluorescent bulbs. Although they are less friendly to the environment, incandescent bulbs are the best choice as far as limiting blue light exposure. You can also look for LED and fluorescent bulbs that contain a special coating inside that filters out some of the blue light. While any consistent exercise is good, aerobic exercise, in particular, is associated with improving deep sleep. Keep in mind, however, that vigorous exercise near bedtime20 might actually make it harder for you to fall asleep. Allow at least an hour20 between your exercise session and when you plan to sleep. If you find yourself feeling tired during the day due to poor sleep the night before, resist the urge to take a nap. It will be much easier to sleep at night if you don’t allow your body to fall out of its daily rhythm of sleep and wakefulness. Caffeine can make it take longer to fall asleep21, and people tend to sleep for a shorter amount of time and wake up more often. One study even found that caffeine consumption six hours before bed still interrupted sleep quality and reduced sleep time by more than an hour. If you must drink caffeinated beverages (which has its benefits, by the way), try to finish more than six hours before bed to avoid messing with your shut-eye. That includes coffee, tea, sodas, and energy drinks as well. As holistic psychiatrist Ellen Vora, M.D., explains, “Though it can make it easier to fall asleep, it decreases the quality of sleep and makes it harder to sleep through the night,” which means, you’ll wake up groggy, not energized. So, skip the booze and lean on the tips here to help you fall asleep and stay asleep. If you want to fall asleep naturally and get a good night’s rest, it’s best to stay away from smoking, vaping, and other nicotine-containing substances. Researchers suggest meal timing is one of the ways that our body sets its internal clock23. When we eat at the wrong times, it can throw our internal timekeeping mechanism awry, wreaking havoc on our sleep patterns. In fact, several studies22 have found a link between eating late dinners or eating more calories late in the evening and short sleep duration (less than five hours). Although more research is needed to understand the optimal eating patterns for better sleep, it’s probably a bad idea to eat late dinners or a heavy pre-bed snack if you want to get to sleep on time. Instead, try eating your dinner early. And, if you absolutely must eat later, keep it light and only eat until your hunger is satisfied. A mattress that’s too lumpy or hard, or bedding that is too hot or scratchy is just plain irritating, and it distracts you from relaxing properly. If you find yourself feeling dissatisfied with something about the comfort of your bed, it’s important to correct it in order to create the best environment for relaxation and rest. To keep your mattress in top condition, the National Sleep Foundation recommends that it should be replaced every five to seven years. Pillows need to be replaced annually. While this might seem odd given that we’re trying so hard to avoid blue light in the evening, it’s really all about timing. We need blue light at the correct time of day to tell our bodies when it’s time to be awake and when to sleep. One study, involving 109 office workers who were exposed to bright morning light, found that they had better self-reported mood and sleep. In addition, research indicates that blue-enriched light25, like morning sunlight, can improve sleep, alertness, and performance. Try taking a walk outdoors, or invest in a light therapy lamp. However, if nothing seems to be working, talk to your health care provider or consult a sleep specialist. There may be an underlying illness or sleep disorder, which requires professional assistance to treat. She is a freelance writer and president of Depression Sanctuary, a non-profit organization that offers free support to those suffering from depression and other mental illnesses. She lives in San Antonio, TX.