If you’ve been suffering sleepless nights and agonizing mornings, you know all too well the impact an irregular sleep cycle has on your life. Chronic sleep deprivation poses a serious health hazard, upping your risk of obesity, diabetes, heart disease and depression. We asked top sleep experts how to develop a healthy sleep cycle — and how to tweak it to fit your work schedule and life.

Sleep Cycles 101

Your brain follows a natural sleep cycle, called a circadian rhythm, that’s primarily guided by light. For the simplest explanation, Nitun Verma, MD, a sleep specialist and co-founder of health technology company PeerWell, likens our circadian rhythm to the daily habits of a farmer:

Farmers do their most arduous, tasking jobs early in the day under bright light, slowly reduce their activity as the light dims, and fall asleep after the sun sets. Your brain follows a similar activity pattern — it’s most active when exposed to bright light, reduces activity as the light dims and relaxes when you sleep.

No matter what your desired schedule, you’ll need to adjust your light exposure to change your brain’s natural sleep cycle.

Identify Bad Habits

The top three sleep-sabotaging sins? Overworking, clocking too much screen time and keeping irregular hours.

“A lot of my patients are so busy they’re working all the way until bedtime,” says Verma. “Their stress is off the charts and they’re looking at screens that give off pure white light, which contains lots of blue light.”

Those blue light rays trick your brain into thinking it’s daytime, so it’s harder to fall asleep at night, explains Verma. Stress also taxes your brain, which interrupts your sleep cycle. Recreational electronic use — like checking Facebook on your phone — isn’t much better.

Keeping irregular sleep hours means you’re not following any schedule, so your body has no regular sleep cycle to adjust to.

All three sleep issues are fixable, and you’ll need to correct them to develop your sleep cycle.

Choose Your New Schedule

First thing’s first — you’ll need to plan a schedule that leaves enough time for quality shut-eye. The National Sleep Foundation recommends that adults from age 18 to 64 get 7 to 9 hours of sleep per night, while adults age 65 or older get 7 to 8 hours. While your needs might deviate slightly from the general recommendations, they’re a good starting point. Figure out your bedtime based on your desired waking time, and stick to those hours every day.

Reduce Work-Related Stress

In a perfect world, you’d be able to leave your work at the office and have lots of time at night to relax, but that’s not always the case. If you have to work at home, get the most stressful tasks out of the way as soon as possible.

Over the course of your evening, switch to easier work and gradually dim the light in your office to mimic the setting of the sun. Set reminders to turn down the brightness on your smartphone and computer, or invert the colors on your screen. Low light naturally advances your circadian rhythm, which prepares you for sleep.

Limit Your Screen Time

Even inverted or dim screens give off some sleep-interrupting blue light, so you’ll need to quit electronics before you go to sleep.

Ideally, you should avoid all light-emitting electronics for three hours before you go to bed. If that’s not possible, aim for at least an hour of screen-free time at the end of the day. In a worst-case scenario, just do what you can. “Even 10 to 15 minutes is better than nothing,” says Verma.

Don’t Wreck Your Weekends

Follow your sleep schedule seven days a week. But if that’s not possible, stick within two hours of your planned sleep and wake times on the weekend, recommends Dr. Andrew Westwood, MD, assistant professor at Columbia University Medical Center and sleep expert at ColumbiaDoctors Midtown. Some people are more sensitive to sleep changes than others. As you develop better sleep hygiene, you’ll learn how much you can comfortably sleep in on the weekend without ruining your cycle.

If you find yourself crashing every weekend, that’s a sign you aren’t getting enough sleep during the week and should adjust your schedule to include more sleep time. Contrary to popular belief, you can’t “catch up” on sleep by oversleeping on the weekend.

When your weekend plans go completely off the rails, salvage your sleep with two emergency tips:
* Start your sleep hygiene schedule an hour earlier on Sunday evening to give yourself more time to turn “off.”
* On Monday morning, drench yourself in light by opening the drapes and turning on the lights for at least 30 minutes immediately after you wake up. This light stimulation balances your melatonin levels, so you’ll start to feel more alert.

Adjust to the Night Shift

If your work hours get in the way of a typical sleep cycle, you’ll need some advance planning to maintain good sleep hygiene. Take the longest nap possible before your shift starts and time your nap around your natural mid-afternoon energy slump to help you fall asleep. Once you’re at work, create a bright environment to trick your brain into thinking it’s daytime.

Daytime sleeping after your shift requires some tweaks, too. Tone down the light in the last two hours of your shift, recommends Dr. Westwood, and wear blue light-blocking glasses on the way home. These glasses, available without a prescription, help reduce your blue light exposure so your brain can start to prepare for sleep.

It’s especially important to stay consistent on your days off when you work night shifts, says Westwood. “You want to keep the same hours on the weekend, or it will impact you that second week.” Ask for shift blocks of two weeks or more, since switching from the night shift to the day shift and back every week is especially tough on your system.

Melatonin Myths

Don’t be tempted to turn to melatonin, one of the hormones that controls your circadian rhythm, as a natural alternative to sleep medications. Most people don’t use it effectively. If you’re having trouble adjusting your sleep cycle through behavioral and light changes, talk to a sleep expert to create a melatonin treatment schedule designed to shift your circadian rhythm and make it easier to sleep.