Background: Sexual risk behavior is now the primary vector of HIV transmission among substance users in the United States with gender as a crucial moderator of risk behavior. Objectives: The purpose of this study was to examine gender differences in factors (age, race/ethnicity, education) that predict main-partner unprotected sexual occasions (USO) using the unique platform of two parallel NIDA National Drug Abuse Treatment Clinical Trials Network gender-specific safer sex intervention trials. Methods: Baseline assessments of male (N = 430) and female (N = 377) participants included demographic characteristics; past 3-month sexual activity; and a diagnostic assessment for alcohol, cocaine/stimulant, and opioid use disorders. Using mixed effects generalized linear modeling of the main outcome USO, two-way interactions of gender with age, race/ethnicity, and education were evaluated and adjusted by alcohol, cocaine/stimulant, or opioid use disorder. Results: When adjusted for alcohol use disorder, the interaction of education and gender was significant. For men, a high school or greater education was significantly associated with more USO compared to men with less than high school. For women, greater than high school education was significantly associated with less USO compared to women with a high school education. None of the other interactions were significant when adjusted for cocaine/stimulant or opioid use disorder. Conclusions/Importance: This study demonstrates gender differences in the relationship of education, alcohol use disorder, and main-partner USO in individuals in substance abuse treatment. This underscores the importance of considering demographic and substance use factors in HIV sexual risk behavior and in crafting prevention messages for this population.