In-group cohesion is an essential component of successful intergroup competition in both human and nonhuman animals, likely facilitating group members access to potential benefits. However, when benefits are equally shared among group members, group defense becomes a collective action problem, which might subvert cohesive participation during intergroup competition. There is a lack of consensus across studies and species with regard to the link between in-group cohesion and intergroup competition, likely as a result of species differences in managing the collective action problem. Here, we examine this link in a species with a striking example of collective action during intergroup competition, chimpanzees (Pan troglodytes verus). Using two years of focal-follow data on males and females in two groups at the Taï Forest, Côte d'Ivoire, we investigated the immediate and long-term effects of intergroup competition (border patrols and intergroup encounters) on measures of in-group cohesion, namely modularity, party size, and intergroup aggression. We found that groups' association patterns were less modular (more cohesive) in months in which they engaged in more border patrols and intergroup encounters. We found that current and greater prior engagement in intergroup competition predicted larger party sizes. Furthermore, current, but not prior engagement in intergroup competition, predicted reduced intragroup aggression by males but not by females. Increased in-group cohesion in chimpanzees likely reduces potential costs of intergroup competition engagement, by facilitating joint participation in current and future intergroup conflicts, overcoming the collective action problem.