Pain in HIV frequently co-occurs with substance use and depression. The complex associations among patient characteristics, pain, depression, and drug use in HIV suggests a role for testing models that can account for relationships simultaneously, control for HIV status and also test for mediation. Using structural equation modeling (SEM), the current study examined associations among pain, sociodemographics, illicit drug use and depressive symptoms in 921 HIV seropositive and 1,019 HIV seronegative men from the Multicenter AIDS Cohort Study (MACS), an ongoing prospective study of the natural history of HIV infection among gay/bisexual men. Longitudinal repeated measures data collected over a 6 year period were analyzed using predictive path models in which sociodemographics, HIV status and CD4+ cell counts predicted pain which in turn predicted depressive symptoms and illicit drug use. The path models did not differ substantially between HIV seropositive and seronegative men. Analyses using the total sample indicated that pain served both as a mediator and as a predictor of more use of cannabis, cocaine and heroin, as well as more depressive symptoms. HIV seropositive status predicted more use of inhaled nitrites. In this cohort, having lower CD4+ cell counts (predicted by HIV status), being African-American, less educated, and older were all associated with more pain which in turn was associated with more illicit drug use and more depressive symptoms. The results underscore the need for adequate pain management, particularly among vulnerable subgroups of HIV seropositive and HIV seronegative men to reduce the risk of drug use and depression.