We conducted a study to determine the prevalence and sociodemographic distribution of unsafe sexual behaviors among psychiatric inpatients and to investigate an association between crack cocaine use and these behaviors. Two hundred thirty-nine patients admitted to two Philadelphia hospitals during a 12-month period were interviewed to obtain a detailed sexual history and substance abuse history. A history of multiple sex partners was reported by 42.6% of male patients and 13.0% of female patients (p < .01). A history of receptive anal intercourse in the past 6 months was reported by 11.6% of females and 2.1% of males (p < .05). Only about half the study subjects who were sexually active reported ever using a condom during the past 6 months. Crack cocaine use among males and cocaine use among females was statistically significantly associated with a history of having sex with a high risk partner. This study draws attention to the role of crack cocaine and other types of cocaine in the spread of human immunodeficiency virus infection in this population and the need for intensive acquired immunodeficiency syndrome prevention programs on inpatient psychiatric units.