Methodologic biases may explain why observational studies examining metformin use in relation to lung cancer risk have produced inconsistent results. We conducted a cohort study to further investigate this relationship, accounting for potential biases. For 47,351 patients with diabetes ages ?40 years, who completed a health-related survey administered between 1994 and 1996, data on prescribed diabetes medications were obtained from electronic pharmacy records. Follow-up for incident lung cancer occurred from January 1, 1997, until June 30, 2012. Using Cox regression, we estimated lung cancer risk associated with new use of metformin, along with total duration, recency, and cumulative dose (all modeled as time-dependent covariates), adjusting for potential confounding factors. During 428,557 person-years of follow-up, 747 patients were diagnosed with lung cancer. No association was found with duration, dose, or recency of metformin use and overall lung cancer risk. Among never smokers, however, ever use was inversely associated with lung cancer risk [HR, 0.57; 95% confidence interval (CI), 0.33-0.99], and risk appeared to decrease monotonically with longer use (?5 years: HR, 0.48; 95% CI, 0.21-1.09). Among current smokers, corresponding risk estimates were >1.0, although not statistically significant. Consistent with this variation in effect by smoking history, longer use was suggestively associated with lower adenocarcinoma risk (HR, 0.69; 95% CI, 0.40-1.17), but higher small cell carcinoma risk (HR, 1.82; 95% CI, 0.85-3.91). In this population, we found no evidence that metformin use affects overall lung cancer risk. The observed variation in association by smoking history and histology requires further confirmation.