If you suffer from insomnia, you may have chalked it up to a late-night meal, stress or too much screen time. But new research shows that a healthy gut is not only important for immunity and overall health, but it could also be the secret to a better night’s sleep.

Circadian rhythms: The gut-brain connection

The circadian rhythm is the internal biological clock in the brain that determines whether you’re a night owl, an early riser or somewhere in between. Consistent sleep schedules and even meal times keep circadian rhythms on track.

“If your brain knows when to go to sleep, it goes to sleep much more quickly and you get into a deeper form of sleep,” said Michael J. Breus, Ph.D., a clinical sleep specialist in Los Angeles and author of “The Power of When.”

A growing area of research is looking at how gut health affects sleep and vice versa. In fact, a study in the journal PLOS One observed that mice fed a high-fat, high-sugar diet and who also had circadian rhythms disruptions were found to have altered gut flora.

Another study in the journal Cell found that jet lag can alter gut bacteria and may even make a person more susceptible to diabetes and obesity.

“The question becomes, [does] the cyclical rhythm in the stomach coordinate with the cycle rhythm in the brain and the answer is: nobody knows,” Breus said.

The gut: The “second brain”

The gut has been dubbed the second brain because—with 30 types of neurotransmitters and 100 million neurons— there’s more brain-type tissue in the gut than in the spinal cord, said Shawn Stevenson,  a nutritionist in St. Louis, Missouri and bestselling author of “Sleep Smarter: 21 Essential Strategies To Sleep Your Way To A Better Body, Better Health and Bigger Success.”

In fact, 90 percent of serotonin, the building block for the sleep hormone melatonin, is located in the gut. There is also 400 times the amount of melatonin in the gut than there is in the brain and certain bacteria in the gut are important for the production of serotonin, according to study published in the journal Cell.

More on this...

The vagus nerve also plays an important role in sleep.  Although this cranial nerve runs from the brain down through the neck and into the abdomen, 95 percent of information travels from the gut to the brain, not the other way around.

Health conditions can affect gut health, too

Research is also being done on how other factors can affect the gut and in turn, sleep. In fact, obstructive sleep apnea, which affects more than 18 million adults in the U.S., could alter the microbes in the gut, the European Respiratory Journal found.

It’s also well documented that stress can affect the microbiome and lead to gut hyperpermeability. Although a clear cause and effect relationship has not been confirmed, there seems to be a relationship between gut health and its effect on anxiety, depression and pain— which can all affect sleep, Breus said.

Although the connection between gut health and sleep is always evolving, experts say there are things you can do to keep your digestion healthy and improve your sleep.

1.      Be consistent
Travel, late night Netflix binge watching, or opting for a late brunch instead of breakfast can all throw your circadian rhythms off. Do your best to have consistent meal times and go to sleep and wake up at the same time every day, even on the weekends.

2. Get your vitamins
An estimated 80 percent of people in the U.S. are deficient in magnesium, a mineral that’s responsible for 300 biochemical processes in the body and studies show getting enough can help insomnia.

Eat magnesium rich-foods like almonds and spinach. Taking an oral supplement can help, but too much can lead to diarrhea. Instead, look for a quality magnesium spray, an oil or soak in an Epsom salt bath, Stevenson said.

3. Take probiotics and prebiotics
Probiotics, which support healthy gut flora, are found in fermented foods like sauerkraut, kimchi and kefir or in supplement form.  It’s also important to get prebiotics, which help probiotics work. Foods with prebiotics include garlic, onions and Jerusalem artichokes.