This retrospective cohort study investigated whether metformin may reduce gastric cancer risk by using the reimbursement databases of the Taiwan's National Health Insurance. Patients with type 2 diabetes diagnosed during 1999-2005 and newly treated with metformin (n=287971, "ever users of metformin") or other antidiabetic drugs (n=16217, "never users of metformin") were followed until December 31, 2011. The effect of metformin (for ever versus never users, and for tertiles of cumulative duration of therapy) was estimated by Cox regression incorporated with the inverse probability of treatment weighting using propensity score. Results showed that the respective numbers of incident gastric cancer in ever and never users were 759 (0.26%) and 89 (0.55%), with respective incidences of 55.26 and 122.53 per 100,000 person-years. The overall hazard ratio (95% confidence intervals) of 0.448 (0.359-0.558) suggested a significantly lower risk among ever users. In tertile analyses, hazard ratios (95% confidence intervals) for the first (<21.47 months), second (21.47-45.97 months) and third (>45.97 months) tertile of cumulative duration was 0.973 (0.773-1.224), 0.422 (0.331-0.537) and 0.120 (0.090-0.161), respectively, while compared to never users. In conclusion, metformin significantly reduces gastric cancer risk, especially when the cumulative duration is more than approximately 2 years.