To resolve the mechanisms that switch competition to cooperation is key to understanding biological organization. This is particularly relevant for intrasexual competition, which often leads to males harming females. Recent theory proposes that kin selection may modulate female harm by relaxing competition among male relatives. Here we experimentally manipulate the relatedness of groups of male Drosophila melanogaster competing over females to demonstrate that, as expected, within-group relatedness inhibits male competition and female harm. Females exposed to groups of three brothers unrelated to the female had higher lifetime reproductive success and slower reproductive ageing compared to females exposed to groups of three males unrelated to each other. Triplets of brothers also fought less with each other, courted females less intensively and lived longer than triplets of unrelated males. However, associations among brothers may be vulnerable to invasion by minorities of unrelated males: when two brothers were matched with an unrelated male, the unrelated male sired on average twice as many offspring as either brother. These results demonstrate that relatedness can profoundly affect fitness through its modulation of intrasexual competition, as flies plastically adjust sexual behaviour in a manner consistent with kin-selection theory.