Due to the global burden of HIV, a better understanding of the relationship between substance use and HIV risk behavior is a public health priority, particularly among populations with high rates of HIV infection. The current study explored the moderating effects of psychosocial factors on the relationship between substance use and sexual risk behavior. Among 480 black South African men who have sex with men recruited using respondent-driven sampling, a cross-sectional survey was conducted that included questions about their last sexual event that involved anal sex. Substance use was not associated with unprotected anal intercourse (UAI) (P = 0.97). The effect of substance use on UAI was modified by safer sex intentions (P = 0.001). Among those with higher safer sex intentions, substance use was positively associated with UAI (aOR = 5.8, 95%CI = 1.6–21.3, P < 0.01). This study found that among men who have sex with men with high intentions to engage in safer sex, substance use was associated with increased risky sexual behavior.