In many parts of Africa, women are most likely to become infected with HIV by having unprotected sex with their husbands, who may have acquired the virus through extramarital sex. However, the ways in which aspects of community environments-particularly those related to gender equity-shape men's extramarital sexual risk-taking are not well understood. Demographic and Health Survey data from eight African countries (Chad, Ghana, Malawi, Nigeria, Tanzania, Uganda, Zambia and Zimbabwe) were used to examine associations between married men's engaging in risky extramarital sex (i.e., having had both unprotected sex and extramarital sex) and indicators of gender equity and other community characteristics. Separate multilevel logistic regression models that incorporated individual, household and community measures were created for each country. In five countries, men who lived in communities with more equal ratios of women to men with at least a primary education were less likely to report risky extramarital sexual activity (odds ratios, 0.4-0.6). A similar relationship was found in four countries for the ratio of women to men who were employed (0.4-0.5). In three countries, men who lived in communities with more conservative attitudes toward wife-beating or male decision making had elevated odds of extramarital sexual risk-taking (1.1-1.5). While HIV prevention programs should focus on reducing gender inequities, they also need to recognize the conservative cultural factors that influence the formation of men's masculine identities and, in turn, affect their sexual behavior.