Being friends with someone who is depressed does not put you at risk of becoming depressed and it is likely to help the depressed person recover.
Infact, a healthy mood spreads faster through social networks but depression does not, say researchers.
Researchers from the Universities of Manchester and Warwick looked at over 2,000 adolescents in a network of US high school students to see how their mood influenced each other by modelling the spread of mood using similar methods to those used to track the spread of infectious diseases.
The team said while depression does not "spread", having enough friends with healthy mood can halve the probability of developing, or double the probability of recovering from, depression over a 6-12 month period.
In the context of depression, this is a very large impact.
Researchers know that social factors, for example living alone or having experienced abuse in childhood, influences whether someone becomes depressed.
"We also know that social support is important for recovery from depression, for example having people to talk to," said study co-author Thomas House from the University of Manchester.
"This was a big effect that we have seen here. It could be that having a stronger social network is an effective way to treat depression," House said.
The study was published in the journal Proceedings of the Royal Society B.