A little sunshine may do the trick for those suffering from two otherwise gloomy health conditions.

Recent studies shed light on the role vitamin D plays in multiple sclerosis (MS) and fibromyalgia—two chronic, incurable, and often debilitating conditions.

In a study published in JAMA Neurology, researchers from the Harvard School of Public Health (HSPH) in Boston studied patients with MS, finding that those with higher levels of vitamin D fared much better than those with lower levels.

They examined the vitamin D levels of 465 participants who were followed over a five year period as part of a study to monitor patients given Betaseron, an FDA-approved MS drug. They discovered that increasing vitamin D levels within the first 12 months of drug therapy resulted in a 57 percent lower risk of relapse.

According to the study, patients with low vitamin D levels early on in the course of the disease had a higher risk factor for long-term MS progression.

Read More: Vitamin-D Deficiency Makes Bones Age Prematurely »

But does the disease cause a reduction in vitamin D, or do the lower vitamin levels play a part in aggravating the disease? It’s the classic ”chicken or egg” conundrum.

In an interview with Healthline, lead author Alberto Ascherio, D.P.H., M.D., a professor of epidemiology and nutrition at HSPH said, “Most likely, disease activity is exacerbated by low vitamin D levels,” based on what they found in the study.

In a separate study conducted by researchers in Vienna, Austria, vitamin D levels were also shown to be associated with lower levels of pain and fatigue in fibromyalgia patients.

Thirty study participants were divided into two groups. One group received vitamin D supplements while the other took a placebo. In the group that received supplements, researchers noticed a significant reduction in both pain and fatigue symptoms.

The findings bring promise of mild relief to those with fibromyalgia syndrome (FMS), which lead investigator Florian Wepner, M.D., said in a press release “is a very extensive symptom complex that cannot be explained by a vitamin D deficiency alone.”

Use This Interactive Tool to Visualize How Vitamin D Affects MS »

Though we may not know all the answers about how vitamin D acts on MS or fibromyalgia, maintaining proper vitamin levels is vital for our health. But what is considered an optimal dose?

According to the National Institutes of Health (NIH), for people ages nine and up, the safe, maximum intake level is 4,000 IU of vitamin D per day.

There are several ways to raise your vitamin D level, but the simplest is to get some sun. Just 10 to 15 minutes of sun exposure three times a week is all it takes.

“The sun needs to shine on the skin of your face, arms, back, or legs (without sunscreen).” recommends the NIH, but “because exposure to sunlight is a risk factor for skin cancer, you should use sunscreen after a few minutes in the sun.”

Ascherio agrees that “a combination of good nutrition and judicious sunshine exposure may help,” but, he says, “most people living at high latitudes need supplements to maintain healthy levels year around.”

If you don’t live in a sunny place, it may be harder to maintain an adequate level of vitamin D. In that case, you can also get vitamin D through your diet or with supplementation.

“Most milk in the United States is fortified with 400 IU vitamin D per quart,” but the NIH cautions, “It should be noted that foods made from milk, such as cheese and ice cream, are usually not fortified.” And the best food source for vitamin D? The NIH says fatty fish like tuna, salmon, and mackerel.

“Vitamin D supplementation may be regarded as a relatively safe and economical treatment for FMS patients,” Wepner said. “An extremely cost-effective alternative or adjunct to expensive pharmacological treatment, as well as physical, behavioral, and multimodal therapies, Vitamin D levels should be monitored regularly in FMS patients, especially in the winter season, and raised appropriately.”

No matter how you plan to get more vitamin D into your system, be sure to talk to your doctor first. Have a baseline test done to determine your current levels and go from there. Whether you suffer from MS or FMS, it’s clear that maintaining proper levels of vitamin D is essential to managing your condition.