Human cooperation in social dilemmas challenges researchers from various disciplines. Here we combine advances in experimental economics and evolutionary biology that separately have shown that costly punishment and reputation formation, respectively, induce cooperation in social dilemmas. The mechanisms of punishment and reputation, however, substantially differ in their means for 'disciplining' non-cooperators. Direct punishment incurs salient costs for both the punisher and the punished, whereas reputation mechanisms discipline by withholding action, immediately saving costs for the 'punisher'. Consequently, costly punishment may become extinct in environments in which effective reputation building--for example, through indirect reciprocity--provides a cheaper and powerful way to sustain cooperation. Unexpectedly, as we show here, punishment is maintained when a combination with reputation building is available, however, at a low level. Costly punishment acts are markedly reduced although not simply substituted by appreciating reputation. Indeed, the remaining punishment acts are concentrated on free-riders, who are most severely punished in the combination. When given a choice, subjects even prefer a combination of reputation building with costly punishment. The interaction between punishment and reputation building boosts cooperative efficiency. Because punishment and reputation building are omnipresent interacting forces in human societies, costly punishing should appear less destructive without losing its deterring force.