Taking a hot bath an hour or two before you go to bed can significantly improve sleep, according to a new study. The trick to making it work is getting both the timing and the temperature right.

It seems like moms never get enough sleep. It starts with uncomfortable pregnancy sleep. Next comes horribly broken sleep that goes with caring for an infant. But even after babies are sleep trained and grow into well-rested children, moms often still don't get enough for themselves. Many are burning the midnight oil working from home or catching up laundry and other chores. Even those who get everything done are left with a racing mind and cannot settle down for a restful night's sleep.

READ MORE: You Can’t Get By On Just 5 Hours Sleep, Says New Study

According to researchers at The University of Texas at Austin, a hot bath could help you fall asleep and stay asleep. For optimal results, the water should be between 104 and 109 degrees Fahrenheit. To help you fall asleep faster, the bath should be taken one to two hours before bedtime. As long as you don't take it any later than that, the study shows you should fall asleep about ten minutes faster than normal.

So how exactly does this work? Body temperature and sleep cycles are interrelated. The body's circadian clock drives many biological processes, including sleep and wakefulness. It also regulates the body's core temperature.

Body temperature if 2-3 degrees Fahrenheit higher in the late afternoon/early evening than during sleep, when it is the lowest. On average, body temperature drops about 0.5 to 1 Fahrenheit around an hour before usual sleep time.

Getting into a hot bath cools your core body temperature. This signals your body to produce the hormones that help you get to sleep and stay asleep. According to the research, the optimal time to bathe in warm water was one and a half hours before bedtime.

The research team is now looking into the possibility of designing a bed that adjusts its temperature throughout the night to promote best quality sleep.

READ NEXT: Science Says The More Kids Women Have, The Better They Sleep