We experimentally explore the role of institutions imposing collective sanctions in sustaining cooperation. In our experiment, players only observe noisy signals about individual contributions in finitely repeated public goods game with imperfect monitoring, while total output is perfectly observed as it is often the case in collective action problems in society. We consider sanctioning mechanism that allows agents to commit to collective punishment in case the level of cooperation among members of society falls short of a target. We find that cooperation is higher with collective punishment compared to both no punishment or punishment targeting individuals. Importantly, our results indicate that it is the combination of making a commitment to be punished and the collective nature of punishment which induces cooperation. Our findings show that punishing a group collectively for misbehavior of some of its members induces cooperation when individuals participate in setting up the sanctioning institution. The study contributes to the literature on institutional legitimacy and how to ensure good government performance when dealing with collective action problems, and, by considering commitment, improves enforcement methods criticized for their detrimental effects on some societal groups.