Punishment of free-riders is generally viewed as an important factor in promoting cooperation. But since it is often costly to sanction exploiters, the emergence of such a behavior and its stability raise interesting problems. Players who do not contribute to the sanctions, but profit from the increased level of cooperation caused by them, act as "second-order exploiters" and threaten the joint enterprise. In this paper, we review the role of voluntary participation in establishing and upholding cooperation with or without punishment. In particular, we deal with two distinct forms of punishment, namely peer punishment and pool punishment, and compare their stability and their efficiency. The emergence and upkeep of collaborative undertakings can strongly depend on whether participation is voluntary or mandatory. The possibility to opt out of a joint enterprise often helps in curbing exploiters and boosting pro-social behavior.Keywords Evolutionary game theory · Public goods games · Cooperation · Costly punishment · Social dilemma · Voluntary interactions For online experimentation, we refer to http://www.hanneloredesilva.at/sanctions and the VirtualLabs at