The adaptive function of male masturbation is still poorly understood, despite its high prevalence in humans and other animals. In non‐human primates, male masturbation is most frequent among anthropoid monkeys and apes living in multimale–multifemale groups with a promiscuous mating system. In these species, male masturbation may be a non‐functional by‐product of high sexual arousal or be adaptive by providing advantages in terms of sperm competition or by decreasing the risk of sexually transmitted infections. We investigated the possible functional significance of male masturbation using behavioral data collected on 21 free‐ranging male rhesus macaques (Macaca mulatta) at the peak of the mating season. We found some evidence that masturbation is linked to low mating opportunities: regardless of rank, males were most likely to be observed masturbating on days in which they were not observed mating, and lower‐ranking males mated less and tended to masturbate more frequently than higher‐ranking males. These results echo the findings obtained for two other species of macaques, but contrast those obtained in red colobus monkeys (Procolobus badius) and Cape ground squirrels (Xerus inauris). Interestingly, however, male masturbation events ended with ejaculation in only 15% of the observed masturbation time, suggesting that new hypotheses are needed to explain masturbation in this species. More studies are needed to establish whether male masturbation is adaptive and whether it serves similar or different functions in different sexually promiscuous species.