Experts reveal how you can sweat your way to better sleep and sleep your way to better workouts, reports Shape.

“The functions of sleep are to conserve energy and to repair tissues in the body,” says Bradley Cardinal, Ph.D., a codirector of the Sport and Exercise Psychology Laboratory at Oregon State University. The more time you spend in the gym, then, the more shut-eye your body needs, says Cardinal. The results can be dramatic: After working out for four months, insomniacs got a life-changing 85 more minutes of sleep a night—better than any drug can deliver, a study in the journal Sleep Medicine found.