It’s 3 a.m. You’re tossing and turning. You can’t fall asleep — it can be so frustrating.

Everybody has an occasional poor night’s sleep. And millions of people have chronic sleep issues that can take a toll on their lives.

“We rightly attribute a great deal of importance to a good night’s sleep,” says says Stephen Amira, a psychologist at Brigham and Women’s Hospital in Boston, who has seen a lot of patients who struggle with insomnia.

When we don’t sleep well, anxiety can set in. We may lie in bed worrying. “The thoughts can really start to run rampant,” Amira says.

But there are strategies that may help you tackle insomnia. They’re based on one of the most effective treatments ever studied — cognitive behavioral therapy for insomnia — CBT-I for short.

Unlike sleeping pills, CBT-I gets to the root cause of poor sleep. So whether you have chronic insomnia or just a bad night here and there, these tips may help you get to sleep and stay asleep.

1. Log your sleep.

Amira says keeping a log of your sleep can be powerful: “When you observe a behavior, you can actually start to change it just by observing it.” Think of it sort of like tracking your spending before you make a budget.

This basically means writing down what time you went to bed, what time you think you fell asleep, times you thought you woke up during the night and when you woke up to start the day.

Getting actual data on your sleep patterns is the first step to help you realize that there’s often a gap between your worst-case scenario fears and what’s really happening. You might find that you’re actually getting a few hours of sleep.

2. Write down your anxious thoughts and replace them with neutral ones.

Anxious thought patterns can contribute to trouble sleeping. The next time you’re spiraling in the middle of the night, try to examine your worst-case-scenario thoughts and replace them with something more neutral.

This is easier said than done, but it is possible! Drew Gaddie is proof. She struggled with insomnia for years. During those battles with insomnia, the thoughts crept in. Things like, “I’ll become, you know, a burden upon everyone,” she says.

After she sought help from Amira, he coached her on this. “We want to become mindful of those thoughts,” he says. “And then we’re going to tackle those thoughts logically and rationally.”

So when she had those thoughts, she’d pull out her journal and write them down. Then she’d look at what she wrote and think, “That’s not realistic … if I heard someone else say that, you know, I’d say, are you serious?”

Next, she would strike out that irrational thought and replace it with a more logical one, something like, “Of course I won’t become a burden to my family.”

This exercise helps retrain the brain to push away all of the catastrophizing thoughts and replace them with reality. It turns out that a lot of what we tell ourselves is false — and those false thoughts really can keep you awake at night.

3. Rethink how much time you spend in bed.

Lying awake in bed can contribute to worry about sleep, which makes falling asleep harder. To avoid this cycle, you might need to spend less time in bed.

“It seems paradoxical,” says Amira. “But what we do is we tell people to not spend excessive amounts of time in bed. If they’re not going to sleep, we want them out of bed.”

Use what you learn from your sleep tracking to set a realistic schedule for yourself.

Amira helped Gaddie set up a schedule where she would go to bed at 1:30am every night and wake up at 7:30am. This helped Gaddie consolidate her sleep and start associating her bed with being asleep, which Amira says is the goal.

“We want you to associate your being in bed with sleeping, not with anxiety and worrying about your insomnia.”

4. Find a relaxation technique that works for you.

Relaxation or meditation techniques can help you reduce stress, quiet your mind and tamp down that state of hyperarousal. There are lots of different ways to get to a state of relaxation.

Christina McCrae, a psychologist and a CBT-I expert at the University of Missouri suggests starting with a body scan, an exercise where you bring awareness to each part of your body.

Body scans are often taught as part of a stripped-down approach to meditation. One form of this is called mindfulness-based stress reduction, which has been shown in multiple studies to really help relieve anxiety.

“Over the years whenever I’ve demonstrated this, whether it’s with patients, in classes — with undergraduates, graduate students and anywhere I’ve demonstrated it, I’ve had, almost always, somebody in the audience, in the classroom, who has fallen asleep,” says McCrae.

You could also try one of the many meditation apps out there: Headspace, Calm, 10 Percent Happier, Insight Timer.

There are lots of approaches, so find one that works for you. Over time, you might just see that you can do the deep breathing or meditation techniques you learned without needing an app.

5. Make new rules for your sleeping environment.

Try to use your bed only for sleep (or sex). So if you’re trying to fall asleep and ruminating thoughts creep in, leave your bed. Get out. Don’t try to stick it out.

“When you’re spending a lot of time in your bed doing things other than sleep, you’re building up this sort of learned connection between your bed, your bedroom, with things that are more arousing,” says McCrae. She says you want the time spent in your bed associated with sleep.

“If you get into bed and you start having those automatic thoughts that are negative, after a certain period of time — say 10, 15 minutes — you want to get up and go into another room, do something kind of low-key and only return to your bed when you’re starting to feel sleepy again.”

Another part of this strategy is to get clocks out of your bedroom.

McCrae says constant clock watching adds to anxiety over losing sleep

While you’re at it, try banning devices — phones and computers — from the bedroom for at least an hour before bedtime. Amira says they tend to give off a lot of stimulating blue light, and that’s not good for sleep.

Creating new sleep habits takes time. Using these techniques won’t instantly grant you perfect sleep. It’s not a magic bullet. But generally, CBT-I starts to help people pretty quickly, within a few weeks.

“What I want people to feel is that they are confident that they have an approach that they can use in the future,” says Amira. “So that whatever comes their way, they have confidence that they can handle it.”

If your anxious thoughts are keeping you awake, contact me for help at 704-741-2082.