It is widely understood that the costs and benefits of mating can affect the fecundity and survival of individuals. Sexual conflict may have profound consequences for populations, due to the negative effects it causes males and females to have on one another's fitness. Here we present a model describing the evolution of sexual conflict, in which males inflict direct cost on female fitness. We show that these costs can drive the entire population to extinction. To males, females are an essential, but finite, resource over which they have to compete. Population extinction owing to sexual conflict can therefore be seen as an evolutionary 'tragedy of the commons'. Our model shows that a positive feedback between harassment and the operational sex ratio is responsible for the demise of females, and thus for population extinction. We further show that the evolution of female resistance to counter harassment can prevent a tragedy of the commons. Our findings not only demonstrate that sexual conflict can drive a population extinct, but also highlight how simple mechanisms, such as harassment costs to males and females and the coevolution beween harassment and resistance, can help avert a tragedy of the commons caused by sexual conflict.