Jet lag can nearly ruin a trip and totally throw you off. All of a sudden, you’re wide awake in the middle of the night. You can barely stay awake for dinner. And you’re feeling generally awful 24/7.

Fortunately, sleep researchers have found ways to make jet lag less terrible. The key insight here is that the body’s sleep cycle naturally responds to certain environmental cues — including bright light and food — and you can take advantage of that to shift your sleep cycle accordingly. So here are a few ways to beat jet lag, or at least make it more tolerable:

1) Make sure you’re well-rested before traveling

You’re probably going to lose some sleep while traveling, so you may as well start off in a good place. No reason to add extra sleep deprivation on top of jet lag.

And how do you know if you’re sleep-deprived in the first place? If you regularly fall asleep within five minutes of lying down, that’s a sign of sleep deprivation (or a sleep disorder), according to the National Institute of Neurological Disorders and Stroke.

2) For longer trips, adjust your body’s clock a bit ahead of time

If you’re planning to be in your new time zone for a while, you can start the adjustment process before you even leave home, says Christopher Colwell, a professor of psychiatry at UCLA who studies circadian rhythms. That will give you a head start for when you get there.

Start going to bed and getting up a little later or earlier, depending which direction you’re traveling. (For those traveling west, go to bed and get up a bit later. For those traveling east, do the opposite.) And shift your light exposure accordingly, too. Seek out bright light when it would be daytime at your destination. Avoid it when it would be nighttime there.

3) Drink plenty of water on the plane

Jet lag isn’t the only reason people feel terrible after flying — the jet itself can take a toll. As Joseph Stromberg explains, the lower oxygen and dry air on planes can have all sorts of ill effects.

That’s why researchers recommend drinking plenty of water before and during your flight (and avoiding dehydrating alcoholic and caffeinated beverages), walking around during flights to improve circulation (and the amount of oxygen getting to your brain), and possibly taking an aspirin the day before and the day of your journey (which should also improve circulation).

4) For short trips, it might not be worth trying to fight jet lag

These sunglasses are just to keep us on our sleep schedule back home. Really. (Shutterstock)

Your body takes several days to adjust to a new sleep schedule. So if you’re just going somewhere for a few days, consider trying not to adjust to the new time zone, says Colwell. This will make coming back much easier.

You can do that by tweaking your light exposure. Because light is the main signal that tells your brain when to be sleepy or not, this means exposing yourself to bright light in the new time zone when it’s daytime back home and avoiding bright light when it’s nighttime back home.

So, for example, say you’re visiting Los Angeles from New York City. During your trip, you might want to go for a walk outdoors early in the California morning (when it’s midday in New York), but stay away from bright light in the California evening (when it’s night in New York).

The reverse would be true for California natives visiting New York for a short while. To stay on California time as much as possible, they might want to stay indoors or wear shades in the New York morning and crank up the light exposure in the afternoon and early evening.

5) For longer trips, use light to adjust to the new time zone

If you’re trying to adjust to a new time zone, get lots of light during daylight hours, especially in the mornings. Remember that outdoor light is generally better for retraining your brain — it’s brighter than indoor light (even on a cloudy day). And limit light exposure near bedtime, including from computers and televisions.

If you want to play around with an app that customizes ideal light exposure schedules based on your journey, check out Entrain.

6) Adjust your eating and exercising, too

Some research has shown in mice that eating causes changes in insulin levels, which in turn influence the body’s timekeeping. So try to adjust your meals to wherever you are. For example, if you normally eat breakfast at 8 am in New York, eat breakfast at 8 am in London, too.

The same goes for exercise, Colwell says. After all, your body probably isn’t used to you exercising in the middle of the night. So, in general, do these activities at whatever hours you’re trying to tell your body is daytime.

7) Melatonin might help

Traveling from west to east makes it more likely that you’re going to have trouble falling asleep at night because your body doesn’t think it’s bedtime yet. If that’s the case, consider taking a melatonin supplement right before bed.

Melatonin is the hormone that your brain generates that makes you sleepy. It’s sold over-the-counter at most pharmacies. Because the US government regulates melatonin as a dietary supplement and not a drug, the FDA hasn’t approved it as something that can treat any particular condition.

However, experiments have shown that melatonin can help. A Cochrane review of nine medical studies found that participants who took 0.5 mg to 5 mg of melatonin right before bed reported fewer jet lag symptoms, compared to those who took a placebo pill.

8) Be careful with caffeine

Although you may be tempted to guzzle coffee or soda to stay alert, consuming caffeine later in the day may keep you up at night.

Caffeine has a half-life of six hours in the body, which means that it takes six hours for your body to get rid of just half the caffeine you’ve consumed. So be careful with drinking caffeinated beverages in the afternoon, especially if you’ve just flown from west to east.