Social knowledge beyond one's direct relationships is a key in successfully manoeuvring the social world. Individuals gather information on the quality of social relationships between their group companions, which has been termed triadic awareness. Evidence of the use of triadic awareness in natural contexts is limited mainly to conflict management. Here we investigated triadic awareness in wild Barbary macaques (Macaca sylvanus) in the context of bridging interactions defined as male-infant-male interactions whereby a male (initiator, holder) presents an infant to another male (receiver, non-holder) in order to initiate an affiliative interaction with that male. Analyses based on 1263 h of focal observations on ten infants of one wild social group in Morocco supported the hypothesis that males use their knowledge of the relationship between infants and other adult males when choosing a male as a partner for bridging interactions. Specifically, (i) the number of bridging interactions among holder-infant-receiver triads was positively affected by the strength of the infant-receiver relationship and (ii) when two males were available as bridging partners, a male was more likely to be chosen as the receiver the stronger his social relationship with the infant relative to the other available male. This demonstrates that non-human primates establish triadic awareness of temporary infant-male relationships and use it in a naturally occurring affiliative context. Our results contribute to the discussion about the mechanism underlying the acquisition of triadic awareness and the benefits of its usage, and lend support to hypotheses linking social complexity to the evolution of complex cognition.