IAN HOOTON/SCIENCE PHOTO LIBRARY/Getty Images

If you’ve ever found yourself tossing and turning late at night as you re-play a conversation in your head over and over again, you may have a tendency to overthink things.

Ruminating on things isn’t just a cause of sleepless nights, research shows that dwelling on your mistakes, real or imagined, is linked to depression, enhances negative thinking, impairs problem solving, interferes with instrumental behavior, and erodes social support. To make matters worse, those restless hours spent thinking about things can lead to not only fewer hours of sleep but the sleep you do manage to get is of poorer quality, according to another study. If that’s not alarming enough, other studies reveal that overthinking can lead to emotional distress, which according to Psychology Today, in turn can lead to coping strategies like eating your feelings or downing a bottle of wine, which aren’t any better for you than overthinking.

Rumination is more common in women, but men can be afflicted by obsessive thoughts, too. If you have been known to spend time repeating scenes in your head and going over events incessantly, there are a few things you can do to stop persistently dwelling on distressing situations.

WATCH: 5 One-Minute Ways to Feel Your Best

“Telling yourself to not to have a certain thought is not the way to not have the thought,” clinical psychologist Catherine Pittman, an associate professor in the psychology department at Saint Mary’s College in Notre Dame, Indiana, told the Headspace blog. She suggests trying to replace the thought, instead. So, if you’re obsessing over the idea that your sister is mad at you, consider putting that thought aside and thinking about, say, the contestants on that guilty pleasure reality TV show.

Similarly, if you find yourself overthinking something, try distracting yourself from the thoughts by filling your time. Call your parents, tackle a crossword puzzle, take your dog on a walk, pick up an engrossing thriller, volunteer, visit the library and load up on books. Do anything to keep your mind otherwise occupied.

Another option is, oddly enough, to schedule time to worry. Pittman told Headspace that she often recommends her clients schedule a strict timeline for worrying, for instance, from 1:30 p.m. to 2:30 p.m. During that timeframe, parse the problem, analyze every word, think of every angle, dig in to the details, but when the clock hits 2:30, time’s up and you have to convince your brain to move on.

Once you have analyzed the problem, take action on it. “Ruminators tend to get stuck in the analysis phase of a problem,” Bruce Hubbard, the director of the Cognitive Health Group and an adjunct assistant professor of psychology and education at Columbia University, told Real Simple. Instead of ruminating, try to come up with a concrete solution that you can act on—then do it. That could mean apologizing if you inadvertently offended your mother in law (Southerners do love a good handwritten note) or re-doing work that you believe you have messed up.

If your brain just can’t let something go, Susan Nolen-Hoeksema, who literally wrote the book on rumination (it’s called Women Who Think Too Much: How to Break Free of Overthinking and Reclaim Your Life) suggests teaching yourself not to engage. “Try noticing your thoughts as if they were leaves floating by in a stream,” she told Real Simple. That means letting your worries flow over you, but don’t respond to them, don’t engage with, and just let them go. It’s a way of being mindful about what you let into your brain.

As with almost everything in this life, learning to stop overthinking gets easier with practice. However, if none of the above works for you—or even if they do help—talk to your doctor about whether you may have an anxiety disorder. There may be medicine that can help alleviate your anxiety and in turn your overthinking.