A study found female crested macaques are more likely to respond to alarm calls made by their mates.
The monkeys are known for their sociability and tolerance and the new findings add to evidence about the importance of bonding in the animal kingdom.
Researchers used a mock python, a life-size picture mounted on a metal handle, and taped the alarm call each monkey made. Their friends looked for longer towards the sound.
Dr Bridget Waller, of Portsmouth University, said: "Strong social bonds could improve the co-ordination and efficiency of defence against predators and therefore increase the chances of survival of the individuals."
Pythons, along with dogs and humans, prey on macaques which make a unique prolonged call when sighting the snakes to recruit others to join in a mob-handed counter-attack.
"This is where friendship has such an important role to play, mobbing poses a significant risk on those taking part and its success as a tactic depends on co-ordination and co-operation," Primatologist Jerome Micheletta said.
More From This Section
The researchers do not yet know if friendship evolved in direct response to predators, the Daily Mail reported.
"You could say the costs of losing a friend outweigh the risk of joining in dangerous mobbing behaviour," Waller said.
But other reasons could include helping to avoid the stress of living in large and complex groups.
"Strong social bonds are crucial for humans' health and well-being but friendship is not uniquely human. Similar bonds can be found in a wide range of animals from mice to monkeys and together with dominance and kinship, friendship is a crucial feature of animal societies," Micheletta said.
"We knew friendships were crucial among crested macaques but until now we didn't know whether it played a role during encounters with predators," he added.
"We found friendship influences the way individuals respond to alarm calls given in a potentially deadly situation," Micheletta said.
The study published in Proceedings of the Royal Society B: Biological Sciences was carried out in the Tangkoko Nature Reserve on the Sulawesi island of Indonesia.