Abstract Objective To determine whether the use of glucagon-like peptide-1 (GLP-1) receptor agonists is associated with an increased risk of suicidal ideation, self-harm, and suicide among patients with type 2 diabetes compared with the use of dipeptidyl peptidase-4 (DPP-4) inhibitors or sodium-glucose cotransporter-2 (SGLT-2) inhibitors. Design Active comparator, new user cohort study. Setting Primary care practices contributing data to the UK Clinical Practice Research Datalink linked to the Hospital Episodes Statistics Admitted Patient Care and Office for National Statistics Death Registration databases. Participants Patients with type 2 diabetes. Exposures Two cohorts were assembled, with the first composed of patients who started and continued on GLP-1 receptor agonists or DPP-4 inhibitors between 1 January 2007 and 31 December 2020 and the second composed of patients who started and continued on GLP-1 receptor agonists or SGLT-2 inhibitors between 1 January 1 2013 and 31 December 2020. Both cohorts were followed until 29 March 2021. Main outcome measures The primary outcome was suicidality, defined as a composite of suicidal ideation, self-harm, and suicide. Secondary outcomes were each of these events considered separately. Propensity score fine stratification weighted Cox proportional hazards models were fitted to estimate hazard ratios and 95% confidence intervals (CIs) to estimate the average treatment effect among the treated patients. Results The first cohort included 36 082 GLP-1 receptor agonist users (median follow-up 1.3 years) and 234 028 DPP-4 inhibitor users (median follow-up 1.7 years). In crude analyses, GLP-1 receptor agonist use was associated with an increased incidence of suicidality compared with DPP-4 inhibitors (crude incidence rates 3.9 v 1.8 per 1000 person years, respectively; hazard ratio 2.08, 95% CI 1.83 to 2.36). This estimate decreased to a null value after confounding factors were accounted for (hazard ratio 1.02, 95% CI 0.85 to 1.23). The second cohort included 32 336 GLP-1 receptor agonist users (median follow-up 1.2 years) and 96 212 SGLT-2 inhibitor users (median follow-up 1.2 years). Similarly, GLP-1 receptor agonist use was associated with an increased risk of suicidality compared with SGLT-2 inhibitors in crude analyses (crude incidence rates 4.3 v 2.7 per 1000 person years; hazard ratio 1.60, 95% CI 1.37 to 1.87) but not after confounding factors were accounted for (0.91, 0.73 to 1.12). Similar findings were observed when suicidal ideation, self-harm, and suicide were analysed separately in both cohorts. Conclusions In this large cohort study, the use of GLP-1 receptor agonists was not associated with an increased risk of suicidality compared with the use of DPP-4 inhibitors or SGLT-2 inhibitors in patients with type 2 diabetes.