A long line of research has addressed whether there are sex differences in cooperation and other forms of prosocial behavior. Studies of social dilemmas (situations that pose a conflict between individual and collective interests) have yielded particularly contradictory conclusions about whether males or females are more cooperative. This paper presents an evolutionary framework that synthesizes previous results and generates new insights into the sex and cooperation question. Our framework addresses two general bases of sex differences in cooperation. First, we show how variation in the motivational structure of social dilemmas generates sex differences in cooperation. We then address two aspects of social structure that, according to evolutionary reasoning, generate sex differences in cooperation: the sex composition of the group, and the interpersonal versus intergroup nature of the dilemma. After presenting new hypotheses and reviewing existing research relevant to each hypothesis, we conclude by making suggestions for future research.