We evaluated the effect of antihyperglycemic therapy on the survival of patients with lung cancer (LC). The analysis included patients with LC and concomitant type 2 diabetes. 15,929 patients were classified into five groups: metformin users, insulin users, metformin and insulin users, sulphonylurea users and non-diabetic group. A multivariate analysis showed that exposure to either metformin or to insulin was associated with a lower risk of LC-specific mortality, and this approached statistical significance (HR 0.82, 95% CI 0.72-92 for metformin and HR 0.65, 95% CI 0.44-95 for insulin). When deaths from all causes were considered, only metformin exposure was associated with a significantly lower risk of death (HR 0.82, 95% CI 0.73-0.92). Users of sulphonylurea were at a higher risk of LC-specific and overall mortality (HRs 1.19, 95% CI 0.99-1.43 and 1.22, 95% CI 1.03-1.45). Our study shows a positive effect of metformin on the survival of patients with LC. Moreover, our results show that exposure to insulin was associated with a lower risk of LC-specific mortality, but not with deaths from all causes. The study results suggested that users of sulphonylurea may be at a higher risk of LC-specific and overall mortality.