Epidemiological evidence reveals that patients with type 2 diabetes mellitus (T2DM) have an increased risk of neurodegenerative diseases (NDs), including dementia and Parkinson's disease (PD). The effects of metformin exposure on dementia and PD risk in patients with T2DM are unknown. We evaluated the effects of metformin exposure on the risk of dementia and PD in patients with T2DM. We performed a cohort study by using Taiwan's National Health Insurance Research Database. We recruited 4651 patients in the metformin cohort and a comparable number of nonmetformin controls by using propensity score matching. Multivariate Cox proportional hazards regression was used to estimate the effects of metformin on the risk of dementia and PD after adjustment for several confounding factors. During the 12-year follow-up, the metformin cohort exhibited a higher risk of PD than the nonmetformin cohort (hazard ratio [HR]: 2.27, 95% confidence interval [CI]=1.68–3.07). The metformin cohort had an increased risk of all-cause dementia (HR: 1.66, 95% CI=1.35–2.04). Moreover, metformin exposure increased the risk of Alzheimer's disease (HR: 2.13, 95% CI=1.20–3.79) and vascular dementia (HR: 2.30, 95% CI=1.25–4.22). The effects of exposure duration and dosage on dementia and PD occurrence were also observed. Long-term metformin exposure in patients with T2DM may lead to the development of NDs, including dementia and PD. Additional large-scale, prospective controlled trials are required to confirm the observed association in patients with T2DM.