Pupils who use social media for three hours or more per day have problems falling asleep and struggle to get up for school, say researchers.
University of Glasgow research has found that using sites such as Facebook and Twitter also led to teenagers frequently waking up and having problems getting back to sleep.
Published in BMJ Open, the study involved 1,872 teenagers aged 13-15, who were asked about when they went to sleep, whether they had trouble falling back asleep after waking in the night, and what time they got up the next morning. They were also asked how much time they spent on social networking or messaging sites or apps such as Facebook, Twitter and WhatsApp.
Social media: What do 12-year-olds think about school?
Mental health: Social media 'not linked' to poor pupil mental health
'Devastating impact': Communication fears as two-year-olds use social media
Phone ban: 'Wonderful' move by new school, says psychologist
Some 33.7 per cent were low users of social media (less than one hour per day), while 31.6 per cent were average users (one to three hours), 13.9 per cent were high users (three to five hours) and 20.8 per cent were very high users (more than five hours).
The study found that heavy and very heavy social media users were far more likely to fall asleep late on school nights (after 11pm) than average users, and to sleep in on school days (after 8am).
Very heavy users were also far more likely to wake up throughout the night and have trouble getting back to sleep.
Similar patterns occurred during weekends and holidays, with heavy and very heavy users more likely to stay up late and sleep in.
Low social media users were the least likely to fall asleep late, suggesting minimal social media use produced "optimal outcomes for sleep", the researchers said.
They added: "These findings are consistent with the idea that social media displaces sleep: either directly or indirectly."
Poor sleep linked to poor academic outcomes
The research also found that while girls reported more social media use, boys were more likely to fall asleep late and, on school days, to wake up late. In measures of poor sleep quality, for example, 34 per cent of boys typically took longer than 30 minutes to fall asleep.
The University of Glasgow researchers said going to sleep late on school days is of "particular concern" because late bedtimes on school days "predict poorer academic and emotional outcomes".
Dr Bernadka Dubicka, chair of the child and adolescent faculty at the Royal College of Psychiatrists, said: "Lack of sleep can be hugely damaging, and is often related to poor mental health and academic achievement.
"Children and young people should also avoid using screens in the last hour before bed as this will help them sleep better at night."
Dr Max Davie, officer for health improvement at the Royal College of Paediatrics and Child Health, said: "We recommend that young people stay off all screens for at least an hour before bed so that their brains have time to wind down.
"The content they are viewing plus the light emitted from screens can increase brain stimulation and make it difficult to fall asleep."
He added: "While some screen manufacturers have introduced 'night modes' claiming to emit less blue light, there is no evidence as yet that these are effective.
"Lack of sleep can have a significant negative impact not only on young people's wellbeing but on their relationships with family and friends and in terms of reaching their full potential at school."
In January, MPs on the Commons Science and Technology Select Committee said social media led to damaged sleep patterns, body image issues, bullying and online grooming.
And in February, leading UK doctors including England's outgoing chief medical officer, Professor Dame Sally Davies, said parents should not allow children to take phones and other electronic devices into their bedrooms or use them at mealtimes.