Your muscles ache, your joints are stiff and painful. The skin across your body feels tender and sore, even to the lightest touch. The physical discomfort associated with fibromyalgia is not only very painful—it can also be exhausting, especially when symptoms are flaring and heightened.

People with fibromyalgia often have trouble sleeping. Pain and discomfort keep them awake at night, and prevent them from getting the rest they need. Sleep deprived on top of their pain, they can’t function during the day as well as they’d like. There are some pretty strong scientific connections between how well we sleep and how we experience pain—that’s true for fibromyalgia patients as well as for anyone who has chronic or intermittent pain. Pain makes it harder to sleep and, in turn, a lack of sleep makes us more sensitive to pain. The cycle of poor sleep and pain can be especially frustrating—and difficult to break—for people with fibromyalgia.

There’s some gwomandoctorpatientood news for people with fibromyalgia who have trouble sleeping: New research suggests that treatment that targets sleep may help relieve sleep problems as well as other symptoms among people with fibromyalgia. A group of Spanish sleep scientists found that treating sleep problems with cognitive-behavioral therapy (CBT) can also help to improve fibromyalgia.

What is CBT? It’s a form of therapy that looks at how thoughts, feelings, and behaviors influence one another. It helps people to recognize and understand their emotions and their thought patterns, and to use that understanding to change their behavior in ways that help improve their daily lives. CBT is sometimes used specifically to treat sleep. CBT for sleep helps people to identify the thoughts and feelings that influence their sleep, including fears and anxieties about not being able to sleep. (Anyone who has spent a long, wakeful night watching the clock move closer to wake-up time knows how deeply our anxieties about sleep can affect our ability to sleep.)

CBT for sleep also helps people to change their sleep habits for the better, and avoid sleep traps like staying in bed too long while awake, napping at the wrong times during the day, and relying too heavily on stimulants like caffeine to stay alert during the day.

The Spanish sleep researchers recruited just over 60 fibromyalgia patients for their study. Most of them were women, with an average age of slightly older than 50. (Fibromyalgia tends to occur much more frequently in women than in men.) The patients who received CBT in addition to their regular fibromyalgia treatment improved their sleep, increasing the overall amount of time they were able to sleep throughout the course of a night. They also saw greater improvements to some of their other fibromyalgia symptoms, including the intensity of their pain and the degree to which pain interfered with their daily activities.

Treating sleep is already a part of many fibromyalgia treatment plans. Using CBT might be an even more effective tool in helping fibromyalgia patients to find relief from chronic pain, and rest comfortably and soundly at night.