Engagement in self-destructive and impulsive behaviors is considered to be a cardinal symptom of borderline personality disorder (BPD), and many of the behaviors enumerated in this criterion have been the focus of extensive empirical research. However, very few studies have examined risky sexual behavior (RSB) in particular in BPD. Given evidence that BPD patients with a co-occurring substance use disorder (SUD) may be at increased risk for RSB relative to BPD patients without a SUD, the present study examined the association between BPD and past-year engagement in RSB (particularly, penetrative sex and nonuse of condoms with casual and commercial partners) within a mixed-gender sample of 94 SUD patients in residential treatment, as well as the moderating role of gender in this association. Given past findings of an association between crack/cocaine use and RSB, we also examined the moderating role of lifetime crack/cocaine dependence on the relationship between BPD and RSB. Results demonstrated a significant main effect of BPD on past-year penetrative sex with casual and commercial partners. Significant 3-way interactions between BPD status, lifetime crack/cocaine dependence, and gender were also found for past-year penetrative sex with casual and commercial partners, as well as the likelihood of not using a condom during sex with a casual partner. Post hoc analyses indicated that women with co-occurring BPD and lifetime crack/cocaine dependence were at greatest risk for RSB. Findings replicate extant findings pertaining to the association between BPD and RSB and extend research by identifying relevant factors that may moderate this association.