Can’t sleep? You’re not alone—around one in three people suffer from some form of insomnia. If you find yourself tossing and turning at night, it’s tempting to reach for a sleep aid to help you get that much-needed shut-eye. And there are tons of options on the market, from prescription pills to natural supplements like melatonin.

Proponents claim they’re great for calming down your racing thoughts and inducing deep, restful sleep (the stuff of dreams, if only you could conk out long enough to have them), but are they safe for long-term use? And can your body develop a tolerance to them?

Before you run to the drugstore to cure your insomnia, it’s important to know the different types of sleep aids and how each of them works in your body. Every person is different, so what works for you might not be effective for your friend and vice versa.

OTC Sleep Aids

Many popular over-the-counter pills, like Advil PM or Tylenol PM, contain diphenhydramine, an antihistamine typically used to treat allergy symptoms or motion sickness. This stuff also makes you feel drowsy, which is why it’s commonly used as a treatment for sleeplessness. Combined with painkillers like ibuprofen, it can treat a variety of symptoms—but it’s likely to cause grogginess the next day, especially if you didn’t sleep a full eight hours.

Another common OTC option is doxylamine succinate, the antihistamine in Unisom and Nyquil. Unfortunately, there are even fewer studies out there that examine its effects, but we know that it works similarly to diphenhydramine in the body.

Taken infrequently, these medications won’t hurt you, and they obviously help if you’re suffering from a headache or cold. Just keep in mind that they’re designed as a short-term fix. The FDA recommends that anyone taking sleep aids talk to their doctor if sleeping problems last more than two weeks—and while these pills are marketed as non-habit-forming, it is possible to become psychologically reliant on them, making it hard to stop taking them once you’re in a routine.

Natural Sleep Aids

Sleep remedies like melatonin promise similar results while being gentler on your system. Melatonin is a hormone naturally produced by the body to regulate your sleep cycle, and you produce more of it as the day goes on, with levels peaking in the evening or at night. It can help with short-term sleep disorders (due to work schedule changes or jet lag) or for people who work frequent night shifts.

Melatonin doesn’t work for everyone (for some people, it can cause dizziness, nausea, and headaches) and can worsen rheumatoid arthritis symptoms. It’s recommended that adults take between 0.2 and 5mg as a safe nightly dose, though drugstore pills are commonly sold in doses up to 10 mg. Start with a lower dose and work your way up to see what dosage is most effective for you (one study claims 0.3 is ideal).

Another thing to keep in mind is that it can be hard to tell how much melatonin you’re actually taking. “As melatonin is not regulated like prescription drugs, the actual amount of melatonin that a product contains may not be representative of what the label claims,” says Jocelyn Cheng, M.D., ABPN board-certified neurologist. In fact, the actual content of melatonin in pills that are legally sold can vary from 83 percent less to 478 percent more than the concentration alleged on the label.

Your body does not build up a physical tolerance to melatonin, but there are very few long-term studies about whether it is safe to take consistently. The jury’s still out on this one—there’s no evidence that it harms your body’s natural processing systems, but there’s also no evidence that consistent usage is totally risk-free—or even a legit way to help you sleep. Studies seem to indicate that melatonin may not have a significant benefit—it appears to reduce sleep onset latency by about 7-10 minutes.

If you’re interested in exploring other natural options, there are a variety of herbal and mineral remedies that can assist your body with sleep. “View them as a bridge back to natural sleep,” says Martha Cortes, DDS, dental-sleep medicine expert and owner of Sleep Fitness LLC. Cortes recommends trying valerian root (which could use some better studies on it), chamomile, magnesium, or lavender essential oil, all of which are widely available at grocery or convenience stores.

Prescription Sleep Aids

There are a variety of reasons why someone might need to try a prescription option, but it’s rarely a long-term fix. For people who suffer from chronic insomnia, these medications can be a much-needed solution, but everyone’s sleep situation is different—and frequently, therapies like CBT-I are a better solution than drugs.

Benzodiazepines like temazepam can be used for treatment of insomnia, but they are known to be habit-forming, so it’s best if they’re only used for a short duration. Non-benzodiazepines such as eszopiclone (which is found in Lunesta) minimize these dependence effects but can still cause headache and dizziness.

Another commonly used non-benzodiazepine is zolpidem, the hypnotic found in Ambien, which can also lead to abuse if taken incorrectly. There’s a reason doctors only prescribe these in certain instances—they’re typically not intended for extended nightly use.

The Bottom Line

Right now, we don’t have definitive evidence that your body develops a physical reliance on OTC options like Advil PM, though a few studies have found that it may show potential for abuse or dependence. However, psychological reliance is a real thing, and it’s something to be aware of when you’re trying out a new medication.

It’s fine to use antihistamines when necessary (like when your work schedule is changing or your noisy neighbors just won’t shut up), but remember to give your body a break to keep your natural sleeping patterns in order.

The science behind melatonin is even less certain. Neither Cheng nor Cortes recommends it for long-term use, but it’s hard to say whether it has any long-term negative effects on your body. The biggest thing to note is that it affects everyone differently. “Melatonin supplements are not one-size-fits-all,” Cortes says. “For some, it assists with sleep; yet, for others, it does not.”

Cheng recommends getting into a regular sleep routine rather than relying on medication night after night. “If you’re unable to fall asleep within 20 or so minutes, get out of bed and go to another room with dim lighting and do something low-stress—and don’t return to bed until you’re sleepy again,” she says. “The key is to not stay restless and frustrated in bed.”

Of course, if you consistently have difficulty sleeping, the best idea is to work with a sleep expert who can help you determine the underlying cause for your sleep problem and address it.

Sarah Ellis is a grad student, runner, writer, and very bad dancer. Right this very second, she’s probably drinking kombucha and pretending chocolate is a health food (because it is, duh).