Punishment is an important deterrent against cheating in cooperative interactions. In humans, the severity of cheating affects the strength of punishment which, in turn, affects the punished individual's future behaviour. Here, we show such flexible adjustments for the first time in a non-human species, the cleaner wrasse (Labroides dimidiatus), where males are known to punish female partners. We exposed pairs of cleaners to a model client offering two types of food, preferred 'prawn' items and less-preferred 'flake' items. Analogous to interactions with real clients, eating a preferred prawn item ('cheating') led to model client removal. We varied the extent to which female cheating caused pay-off reduction to the male and measured the corresponding severity of male punishment. Males punished females more severely when females cheated during interactions with high value, rather than low value, model clients; and when females were similar in size to the male. This pattern may arise because, in this protogynous hermaphrodite, cheating by similar-sized females may reduce size differences to the extent that females change sex and become reproductive competitors. In response to more severe punishment from males, females behaved more cooperatively. Our results show that punishment can be adjusted to circumstances and that such subtleties can have an important bearing on the outcome of cooperative interactions.