While cognitive behavioral therapy is the first line of treatment for chronic insomnia, mindfulness-based treatments are on the rise, Shelby Harris, PsyD, a licensed clinical psychologist who specializes in behavioral sleep medicine, tells Shape.

“I find that when my clients use mindfulness, it also helps them with stress and anxiety—two of the biggest reasons that people have trouble sleeping at night,” she says. It’s backed by science, too—a study published in JAMA Internal Medicine found 20 minutes of mindfulness meditation a day significantly improved sleep quality in adults with moderate sleep disturbances. Even if you don’t suffer from insomnia, meditation before bed (and throughout the day) can help with both sleep quantity and quality, says Harris.

So how does it work? If you’ve never heard of sleep meditation before, it’s important to know that it’s not a way to “put you to sleep,” says Harris. Rather, meditation helps give your brain the space to quiet down so that sleep can come naturally, she explains. “Sleep comes in waves and will happen when it wants to—you just have to set the stage for it.”