The burden of substance use among patients with mental illness is prevalent in developing countries including Tanzania with negative consequences on treatment outcomes. However, the current prevalence of substance use and its associated factors in this population remains unclear in Tanzania. This study aimed at determining the prevalence of substance use and associated factors among patients with mental illness at Muhimbili National Hospital, Dar es Salaam Tanzania. We conducted a descriptive cross-sectional study between March and May 2022. Data were collected during a face-to-face interview with patients attending the outpatient clinic at the Psychiatric Unit at MNH. We used a structured social demographic questionnaire and WHO ASSIST V3.0 tool was used to collect the data. Bivariate and multivariate regression analyses were performed using SPSS version 26 to determine the association between patient characteristics and substance use. A p-value of less than 0.05 was considered statistically significant. A total of 364 patients were enrolled. Among these, 215 (59.1%) were males and the mean (SD) age was 35.57 (±9.01) years. We found the prevalence of substance use to be 32.7%, and the most commonly used substance was alcohol (21.7%), followed by tobacco (19.8%) and cannabis (12.7%). Being a male [Adjusted Odds Ratio (AOR): 2.133; 95% Confidence Interval (CI): 1.258-3.619; P=0.005], younger age [AOR:3.301; 95% CI: 1.152-9.453; P=0.026], positive family history of mental illness [AOR:2.423; 95% CI: 1.448-4.056; P=0.001], and having a family history of substance use [AOR:3.721; 95% CI: 2.215-6.252; P=0.001], were significantly associated with substances use. In conclusion, substance use among patients with mental illness is prevalent. Establishing a routine screening program at the psychiatric clinics is essential in identifying substance use among these risk groups and providing appropriate treatment will improve treatment outcomes. Future research should explore help-seeking behaviors and the accessibility of substance use treatment in patients with mental illness.