When Maya Genuardi was 8, bad dreams would wake her up most nights, sometimes several times.

"It became an untenable situation where we weren't sleeping," said her stepfather, Nick Wilson. So he and his wife, Lisa Genuardi Wilson, who live in Bala Cynwyd, consulted their pediatrician and started their daughter on 3 mg of melatonin each evening before bed.

"It really helps," said Maya, now 13, who has been taking the over-the-counter supplement ever since - just one in a rising tide of children using melatonin for sleep, sometimes for years.

To many parents struggling with wakeful kids, melatonin seems like a godsend. But some experts warn that it may not be as safe or effective as it seems.

"I think we get a false sense of security thinking something is 'natural' or 'over-the-counter,' " said psychologist Jodi Mindell, associate director of the Sleep Center at Children's Hospital of Philadelphia.

Melatonin, a hormone that helps regulate the body's circadian rhythm, is produced by the brain's pineal gland. Inactive during the day, the gland begins releasing melatonin as darkness sets in and increases production through the night, encouraging sleep; melatonin levels dip toward sunup, signaling that it is time to wake up. Artificial light can suppress melatonin production, depending on the wavelength.

Sleep disorders have become more prevalent in recent decades, and use of melatonin - the only hormone available in the United States without a prescription - has increased, as well.

Between 2007 and 2012, melatonin use among children age 4 to 17 rose "significantly," according to the National Institutes of Health, from 0.1 percent to 0.7 percent in that age group. Use among adults doubled, to 1.3 percent.

Some pediatric sleep researchers say they rarely meet patients who have not tried melatonin by the time they get to the clinic.

As with other nutritional supplements, popularity and professional guidance diverge.

The American Academy of Pediatrics and the NIH both discourage long-term melatonin use for children due to a lack of research into its safety and effectiveness. Children under 3 should not take it at all, and ages 3 to 5 only under a doctor's close supervision, Mindell said.

Multiple animal studies have found that supplementary melatonin affects the reproductive, cardiovascular, immune, and metabolic systems, according to Babysleep.com, a website of the Pediatric Sleep Council, an organization of international sleep experts.

In humans, there is some evidence that nighttime supplements can cause daytime grogginess, putting teenagers at risk for car accidents. But there has been little research into melatonin's long-term effects on children, perhaps because pharmaceutical companies have little incentive to fund costly clinical trials of a natural hormone that would not yield large profits.

Many clinicians do agree that melatonin may benefit children with insomnia caused by chronic conditions.

Dawn Avagliano, of Rutherford, N.J., gives her autistic 4-year-old son 0.5 to 1 mg of melatonin some nights to calm him down to sleep. She said she keeps it as a "last resort."

An Australian study published this fall in the Journal of Clinical Sleep Medicine interviewed 11 families who used melatonin to help children with neurodevelopmental disorders, such as autism, get their kids to sleep. "My husband and I would happily re-mortgage the house, if I had to, to pay for this stuff," one subject told the researchers.

The study, based on self-reports, did not include objective measures of sleep patterns with and without the supplement.

In the United States, where nutritional supplements are essentially unregulated by the Food and Drug Administration, some experts worry about quality and the range of dosing recommendations for melatonin.

Researchers from the Massachusetts Institute of Technology found in 2001 that the proper dose to help adjust the circadian clock was 0.3 mg in adults. The Mayo Clinic website gives a range of 1 to 5 mg melatonin nightly for up to two months to induce sleep in children. Most pills available online or on store shelves contain 2 to 5 mg.

Just as problematic is knowing under what conditions the supplements were manufactured and what they actually contain. Research published last month in the Journal of Clinical Sleep Medicine found that more than 71 percent of 31 samples contained amounts of melatonin that deviated by more than 10 percent from what was stated on the label; 26 percent of them contained the neurotransmitter serotonin.

Indeed, researchers at Children's Hospital of Philadelphia are hoping to launch a study of melatonin within the next few months but have been wrestling with where to get it.

"There's not really any quality control or checks or controls with what you bring home," said Indira Gurubhagavatula, an associate professor of clinical medicine at the University of Pennsylvania's Perelman School of Medicine. "From pill to pill there's no guarantee that the amount of melatonin is what is advertised on the bottle."

Melatonin doesn't work indefinitely, because the body can acclimate to it, just as we adjust to loud noise shortly after entering a crowded room, Gurubhagavatula said. When she uses melatonin to treat sleep disorders in her adult patients, she does so only for about two weeks. Melatonin can interfere with the body's regular sleep phase, she said, adding that she would not give it to her own child.

David Kennaway, a professor at the Adelaide School of Medicine in Australia who has been researching melatonin for more than 40 years, said in an email that the hormone affects puberty onset and reproduction in many animals.

There is emerging evidence that it may alter glucose tolerance in humans, he said, and it can interfere with other drugs. Other reported side effects include headaches, nausea, hormone fluctuations, and nightmares.

Mindell said that parents should try to determine whether an underlying condition such as anxiety or sleep apnea may be causing a sleep problem before they turn to melatonin.

"I do worry about children getting the message that they would not be able to sleep otherwise," she said.

Vanessa Coke Cohen of Bala Cynwyd had the same concern. Melatonin had been helping her 8-year-old daughter sleep, but she recently switched it out for "old-school" milk and honey. That has been working just as well, she said.

Children should also practice what sleep experts call "good sleep hygiene," said Melisa E. Moore, a psychologist at Children's Hospital of Philadelphia: shutting off iPads, smartphones, and computers 30 to 60 minutes before bed because the devices emit sleep-disrupting light. Moore tells families that "the bed is for sleeping and sleeping is for the bed." The goal is to get children's brains to feel tired when the children tuck in, she said. Establishing a nightly routine can help.

Judith Owens, director of the Center for Pediatric Sleep Disorders at Boston Children's Hospital, said parents often come into her office with the mind-set that melatonin is either great or terrible. "The truth probably lies somewhere in between."

Still, Owens said, "I always tell families that my goal - and I hope that it's your goal, too - is to get your kid off melatonin."