Although varenicline has had a significant effect on smoking cessation in randomized clinical trials, the dose-effect of varenicline treatment for smoking cessation in real-world settings remains unclear. This study aimed to evaluate the association between the duration of varenicline prescription and smoking cessation in Taiwan after adjusting for potential confounding effects and endogeneity bias. A total of 5106 Taiwanese participants received varenicline monotherapy for smoking cessation between March 2012 and September 2016. Multinomial logistic regression (MLR) was used to analyze the association between varenicline prescription duration and smoking cessation, stratified by the frequency of smoking clinic visits and propensity scores of early stopping of smoking cessation treatment. Compared to the reference of nonquitting, longer durations of varenicline prescription were associated with the greater likelihood of immediate and complete quitting (OR = 1.08, 95% CI = 1.02–1.14) and late quitting (OR = 1.14, 95% CI = 1.07–1.20). Among those who were more likely to continue visiting smoking clinics, longer use of varenicline was significantly associated with an increase in immediate-and-complete quitting (OR = 1.19, 95% CI = 1.15–1.23) and late quitting (OR = 1.24, 95% CI = 1.20–1.28). Varenicline prescription duration was not associated with smoking cessation among smokers who visited smoking clinics once. The relationship between varenicline prescription duration and smoking cessation was modified by the frequency of smoking clinic visits and was dependent on quitting process patterns. Encouraging smokers to continue visiting the smoking cessation clinic and use medication will help smoking cessation efforts in Taiwan.