The longer a teenager spends using electronic devices such as tablets and smartphones, the worse their sleep will be, a study of nearly 10,000 16- to 19-year-olds suggests.
More than two hours of screen time after school was strongly linked to both delayed and shorter sleep.
Almost all the teens from Norway said they used the devices shortly before going to bed.
Many said they often got less than five hours sleep a night, BMJ Open reports.
The teens were asked questions about their sleep routine on weekdays and at weekends, as well as how much screen time they clocked up outside school hours.
On average, girls said they spent around five and a half hours a day watching TV or using computers, smartphones or other electronic devices. And boys spent slightly more time in front of a screen - around six and a half hours a day, on average.
Playing computer games was more popular among the boys, whereas girls were more likely to spend their time chatting online.
Any type of screen use during the day and in the hour before bedtime appeared to disrupt sleep - making it more difficult for teenagers to nod off.
And the more hours they spent on gadgets, the more disturbed their sleep became.
When daytime screen use totalled four or more hours, teens had a 49% greater risk of taking longer than an hour to fall asleep.
These teens also tended to get less than five hours of sleep per night.
Sleep duration went steadily down as gadget use increased.
It may be that playing on electronic devices leaves teens with less time to do other things, including sleep, say the researchers - Dr Mari Hysing and colleagues at Uni Research Health, Bergen.
But it could be that screen time interferes with sleepiness.
Staring at an illuminated screen at bedtime could send the wrong signals to our brain, disrupting our natural body clock making us more alert, they suggest.
Dr Hysing said her findings had implications for the wider population as so many people use these devices.
"We know that sufficient sleep is essential for good physical and mental health. Logging off may be one important step toward securing a good night's sleep."
Prof Russell Foster, an expert in sleep and neuroscience at the University of Oxford, said: "This is an important study as it provides empirical evidence that the use of electronic devices before bed does indeed reduce sleep duration."
He said teenagers should be warned of this.