You’re lying in bed, your mind finally starting to rest after a long day. And then you remember: Shoot, you never emailed back your boss about some urgent project, or you never texted your brother back about plans for your dad’s birthday.

More than a quarter of parents send or read emails and text messages after they’ve already gone to bed, according to the Sleep in America survey from the National Sleep Foundation. And the thing is, their kids are copying them: Sixteen percent of children said they did the same thing, and more than half of the kids who admitted to after-hours texting had a parent who reported doing this as well.

All of us, grown-ups and kids alike, need to learn this one secret to better sleep: One hour before bedtime, shut off your electronic devices. That’s it! It’s so easy — the problem is, we don’t act on it. The new survey from the National Sleep Foundation, released on Monday, shows that 89 percent of adults and 75 percent of children have at least one electronic device in their bedrooms, most commonly a television. And more than a third of parents and kids said they sometimes left some sort of electronic on at night, like a TV, tablet or smartphone or an iPod or other music player.

And the kids that have these devices in their bedrooms and leave them on at night slept less than kids who always turned them off, or didn’t have them in their rooms at all, said Kristen Knutson, Ph.D., National Sleep Foundation Sleep in America Poll scholar who is at the University of Chicago. Tablets, smartphones and the like are a quadruple whammy when it comes to screwing with your sleep.

“Light will disturb your sleep — so looking at a screen is going to make it harder for them to sleep. Noise will disturb your sleep especially if it’s left on,” Knutson says. “And also these really, the more interactive devices, like video games or their tablets, are mentally stimulating. And so that’s also going to make it harder for them to go to sleep once they finally try. And it’s a distraction, so they’re just staying awake later because they’re playing with their devices.”

James Maas, a sleep expert, author and retired professor and chair of Cornell University’s psychology department, says that most people don’t realize that our brains register the blue glowing light from all our various screens as if it’s sunlight — which says to your brain, hey, it’s the middle of the day! 

“If you look at these gadgets within an hour of bedtime, what happens is melatonin — the brain hormone that puts you to sleep — has been suppressed for the last hour,” said Maas. “Now, it’s going to take you much longer to go to sleep.”

The survey found that 6- to 10-year-olds are averaging about 8.9 hours of sleep on school nights – hours less than the 10 to 11 they should ideally be getting – and older kids get even less sleep, with 15- to 17-year-olds reporting just 7.1 hours of sleep per night. That’s troubling, Maas says, because that age group should be getting more like 9.25 hours of sleep every night. 

The good news is that parents can make a difference in helping their kids get better sleep. “We did find that parents who always enforce rules about how late their child can use these devices do have children that sleep more than parents who don’t have these rules or don’t enforce them regularly,” Knutson says. 

And parents can also make a difference by setting a good example. More than a third of parents who leave on two or more electronic devices after bedtime have kids who do the same, the survey found.

“We find that many children in our modern society, the modern American family, are not sleeping enough,” Knutson says. “But we find ways that parents can help to get their child to sleep more by setting boundaries, by trying to avoid overscheduling in the evening, and limiting electronic use for themselves and their children so they can set a good example.”

Join our Newsletter for the latest news right to your inbox