We know late-night screens are bad for sleep. How do you stop doomscrolling in bed?

Like many of us, Jessica Peoples has heard the warnings about excessive screen time at night. Still, she estimates spending 30 to 60 minutes on her phone before going to sleep, mostly scrolling through social media.

“Recently, I’ve been trying to limit the amount,” says Peoples, a discrimination investigator with the state of New Jersey. “I do notice that how much time I spend affects how long it takes to fall asleep.”

Over half of Americans spend time on their phones within an hour of going to sleep, according to a survey by the National Sleep Foundation. That’s the very latest we should shut off devices, experts say.

The brain needs to wind down long before bedtime to get the restorative deep sleep that helps the body function, said Melissa Milanak, an associate professor at Medical University of South Carolina specializing in sleep health.

“You wouldn’t take a casserole out of the oven and stick it right in the fridge. It needs to cool down,” Milanak said. “Our brains need to do that too.”

Upending your bedtime routine may not be easy, but insufficient sleep has long been linked to anxiety, obesity and other negative outcomes. Research shows smartphones are particularly disruptive to the circadian clock that regulates sleep and other hormones.

“There are a million and one ways screens create problems with sleep,” said Lisa Strauss, a licensed psychologist specializing in cognitive behavioral treatment of sleep disorders.

The brain, she said, processes electric light — not just a smartphone’s much-maligned blue light — as sunshine. That suppresses melatonin production, delaying deep sleep. Even very little bright-light exposure in bed has an impact.

IT’S NOT JUST THE LIGHT THAT KEEPS YOU UP

Of course, doomscrolling through the news, checking emails or being tempted by ever more tailored videos on social media has its own consequences.

So-called “technostress” amps you up — possibly even triggering the brain’s flight or flight response. And algorithms designed to be engaging compel many social media users to scroll longer than they intended.

“Now it’s 30 minutes later, when you wanted to watch a couple videos and fall asleep,” Milanak said.

Though much of the scientific research on online media focuses on adolescents and young adults, Strauss said most of her clients struggling with insomnia are middle-aged. “People go down these rabbit holes of videos, and more and more people are getting hooked,” she said.

HOW TO BREAK THE HABIT

The issue is not just curtailing phone use in bed, but phone use at night. That means redesigning your routine, particularly if you use your phone as a way to decompress.

It helps to create replacement behaviors that are rewarding. An obvious contender is reading a physical book (e-readers are better than phones but still cast artificial light). Milanak also suggests using that hour before bed to take a warm bath, listen to a podcast, make school lunches for the next day, spend time with family or call a relative in another time zone.

“Make a list of things you like that never get done. That’s a great time to do stuff that doesn’t involve screens,” she said. Using a notepad to write down the to-do list for the next day helps keep you from ruminating in bed.

Do those activities in another room to train yourself to associate the bed with falling asleep. If there’s no other private refuge at home, “establish a distinct microenvironment for wakefulness and sleep,” Strauss said. That could mean sitting on the other side of the bed to read, or even just turning the other way around with your feet at the headboard.

Finally, sequester the phone in another room, or at least across the room. “Environmental control can work better than will power, especially when we’re tired,” she said.

WHAT IF STOPPING DOESN’T FEEL REALISTIC?

There are ways to reduce the harm. Setting the phone on night mode at a scheduled time every day is better than nothing, as is reducing screen brightness every night. Hold the phone far from your face and at an oblique angle to minimize the strength of the light.

Minimize tempting notifications by putting the phone on do not disturb, which can be adjusted to allow calls and messages from certain people — say, an ailing parent or a kid off at university — to go through. But none of these measures give you carte blanche to look at whatever you want at night, Strauss said.

She also recommended asking yourself why checking social media has become your late-night reward.

“Think about the larger structure of the day,” she said. Everyone deserves solitary moments to relax, but “maybe be more self-indulgent earlier so you have what you need.”