All sleep aids work in essentially the same way, by boosting production of a neurotransmitter known as GABA, reports Discover.

GABA helps to quiet down the activity of neurons in our brains, and it’s an important part of our sleep cycles. Almost every drug that makes you drowsy, from barbiturates to benzos to valerian root to alcohol, utilizes this chemical. Low levels of GABA have also been linked to insomnia and anxiety.

But sleeping pills might not be the best path to a healthier relationship with sleep. As neuroscientist and “sleep diplomat” Matthew Walker explains in his 2017 bestseller Why We Sleep: “Sleeping pills do not provide natural sleep, can damage health, and increase the risk of life-threatening diseases.”

While taking drugs like Ambien may help you become unconscious, sedation is not the same as sleep. These hypnotic drugs can actually restrict the deeper brain waves produced during REM sleep, leading to grogginess and forgetfulness the following morning. Feeling sluggish the next day might lead people to consume more caffeine, making sleep difficult and perpetuating the cycle.