It said: "While social websites may provide an additional way to connect with others and form relationships and thus increase children's health, they could also be a source of social comparison, cyber bullying and isolation."
Earlier this year ministers announced a £1.25billion programme to improve mental health services for young people. But they admitted that health professionals knew little about the impact of social media on young people.
The ONS study looked at children aged between ten and 15 and found that 37 per cent spent no time on social networking websites on a typical school day.
But 56 per cent spent up to three hours and 8 per cent spent more than three hours. Of the heavy users, 27 per cent suffered from high levels of mental health difficulties. But this was true of only 11 per cent of children online for fewer than three hours.
For purposes of comparison, mental health difficulties are reported by 41 per cent of bullying victims and by 24 per cent of those who have trouble at home.
Researchers gathered the figures from a survey of 20,000 children, parents and teachers. The Strengths and Difficulties Questionnaire was designed to measure emotional, conduct, attention and friendship problems.
The report said: "There is a clear association between longer time on social websites and higher total difficulties scores."
In 2012 and 2013 - the years covered by the ONS survey - 11 per cent of girls spent more than three hours a day social networking, compared with 5 per cent of boys.
Hayley Van Zwanenberg, a psychiatrist at the Priory Group's Woodbourne Hospital in Birmingham, said: "Children can be totally immersed in a virtual world which is damaging both to the way they see themselves and the way they perceive the real world.
"Some young children are finding it hard to unpick reality from fantasy.
"Children are so trustworthy of modern technologies that they often neglect the fact that it can cause them harm - both directly and indirectly."
She said the fact children spent less time interacting face to face was bad for their social skills, such as the ability to make small talk, actively listen or show empathy.
"They joke and send photos and videos without truly engaging with people, or truly listening to one another," she added.
"They send and make statements without seeing the impact of their comments on the other person. These messages can be misconstrued.
"Children constantly feel the urge to be plugged in and switched on, but parents need to consider the detrimental effects to their development and put in place sensible boundaries."
However, the near-universal use of social media has been linked by some academics with highly positive changes in the behaviour of young people.
They cite steep declines in drinking, smoking and drug abuse among the young, and an unprecedented drop in teenage pregnancy.
Facebook
With 1.49 billion monthly users, Facebook is the world's largest social media network. Users have their own profile page, or 'wall', on which they can post text, videos, photographs and links to other sites. Calendars, messaging and video calls are also available.
Whatsapp
Providing free instant messaging, telephone calls, audio messaging and video calls, Whatsapp is starting to replace traditional mobile text messages and phone calls. It had 900 million users last month - a 50 per cent annual rise.
Instagram
Users can edit, share and comment on photographs and videos with the Instagram app. Bought by Facebook for £1billion in 2012, it has 400 million users.
Twitter
Users post 140-character messages for public display on Twitter, which was founded in 2006. Strong on news and events, it has 316 million users.
Snapchat
This video and picture messaging application has built up a 100 million customer base in just four years.