In order to decrease the occurrence of social exclusion in adolescence, we need to better understand how adolescents perceive and behave toward peers involved in exclusion. We examined the role of friendships in treatment of perpetrators and victims of social exclusion. Eighty-nine participants (aged 9–16) observed exclusion of an unfamiliar peer (victim) by their best friend and another unfamiliar peer. Subsequently, participants could give up valuable coins to altruistically punish or help peers. Results showed that participants altruistically compensated victims and punished unfamiliar excluders, but refrained from punishing their friends. Our findings show that friendship with excluders modulates altruistic punishment of peers and provide mechanistic insight into how friendships may influence treatment of peers involved in social exclusion during adolescence.