A good sleep routine is important for your child’s brain and mental development from the time they are babies until they are adults.

Parents and babysitters know all too well that the words “It’s bedtime” are the trigger for evasive behavior, tantrums, and annoying wheedling. However, despite the sometimes Oscar-worthy performances of kids who want “just five more minutes,” sleep is the most important thing for healthy child development.

The National Sleep Foundation says that sleep is the main driver of brain development in young children. However, this doesn’t happen until circadian rhythms, or the body’s natural cycle of sleeping and waking, are set. In the first four months of life, as babies grow from newborns to infants, their internal clocks start to settle down. Caretakers don’t need to look any further than these tips and tricks for dreamy nights instead of nightmare bedtime routines to help kids get into healthy sleep patterns and develop their minds.

Young Age (4–11 months)

The National Sleep Foundation says that when babies are put to bed when they are tired but not asleep, they are more likely to become “self-soothers.” This means that they can fall asleep on their own at bedtime and put themselves back to sleep during the night. Kim West, LCSW-C, also known as “The Sleep Lady,” says that this method is “the cornerstone of successful sleep training.” This means that parents should put their children in the crib when they are sleepy but still awake.

“Babies start to build their own internal clock between the ages of four and six months,” says West. “They start making melatonin, which is the sleep hormone. Melatonin is released in response to sleep cues like darkness at night and bedtime routines. Putting your baby in a dark room while they’re calm helps condition the brain to produce melatonin as night falls and also encourages self-soothing.

Toddler (1–2 years)

Parents.com says to start a calming routine 30 minutes to an hour before bedtime. This could include giving a bath and reading a few stories. Consistency helps your child develop healthy circadian rhythms, and the time before lights out gives his or her busy mind a chance to calm down.

“Children do best when they have a routine,” West writes for Pampers. “When a young child knows what to expect, they feel safe.” Feeling safe not only makes it less likely that they will cry in the middle of the night, but it also helps build a strong bond between parent and child.

Preschoolers (3–5 years)

The Sleep Foundation says that preschoolers usually sleep 11–13 hours a night, and most of them don’t nap after they turn five. This may sound good to parents and caretakers, but, like toddlers, preschoolers still have self-regulation systems that are still developing. This means that preschoolers often have trouble falling asleep and waking up during the night.

How to fix it? Routine, routine, routine.

KidsHealth says that key ways to help your child sleep are to give them a “winding-down period” a half hour before bedtime and keep playtimes and mealtimes the same every day.

The site also says that the bed should only be used for sleeping and not for playing or watching TV. It also says that you should let your child “choose which pajamas to wear, which stuffed animal to take to bed, etc.” because this shows that the bedroom is a safe, quiet place where the child can relax.

Children in grade school (6–13 years)

In this digital age, it’s tempting to let computers, smartphones, TVs, and other devices into your child’s room. However, this can seriously mess up their natural sleep patterns and lead to less restful sleep, which can cause cognitive problems and poor school performance.

Keep your child’s room cool, dark, and free of devices to avoid the effects of technology that are too stimulating. If you have to, follow The Parent Cue’s advice and change the wifi password an hour before bedtime to make it impossible to browse at night.

Again, routine and a regular time to go to bed are on your side. Even if your child acts out at bedtime, remember that routines build a sense of security and self-discipline, which are both important for healthy growth.