Just the right dose can help you sleep peacefully.

For the millions of people who have trouble falling—and staying—asleep, melatonin can sometimes be the solution. The powerful hormone is naturally produced in your brain and sends the message to your body that it’s nighttime and time to hit the hay. You can also take it as a supplement—it’s sold over-the-counter at your local drugstore.

People commonly make the mistake of assuming that taking higher doses of melatonin will lead to better shut-eye. But the opposite is true: Too much taken at once can cause headaches, nausea, dizziness, or irritability, all of which can disrupt your sleep. So talk to your doctor, who may suggest these dosage guidelines:

For Insomnia or Occasional Sleeplessness

Between two tenths of a milligram and five milligrams 60 minutes before bedtime is a typical dose for adults, while children should take a smaller dose. Too much melatonin can disrupt your sleep cycle, so start with the smallest dose of two tenths of a milligram and increase it as needed. Children with neurodevelopmental disorders often have trouble falling and staying asleep, so melatonin is frequently prescribed to them because it has been found to help them snooze longer. Kids with developmental disorders (including cerebral palsy, autism, and intellectual disabilities) can take larger doses, as recommended by their doctors.