Smoking and occupational pulmonary irritants contribute to multiple sclerosis (MS) development. We aimed to study the association between ambient air pollution and MS risk and potential interaction with the human leukocyte antigen (HLA)-DRB1*15:01 allele. Exposure to combustion-related air pollution was estimated as outdoor levels of nitrogen oxides (NOx) at the participants' residence locations, by spatially resolved dispersion modelling for the years 1990-18. Using two population-based case-control studies (6635 cases, 8880 controls), NOx levels were associated with MS risk by calculating odds ratios (OR) with 95% confidence intervals (CI) using logistic regression models. Interaction between high NOx levels and the HLA-DRB1*15:01 allele regarding MS risk was calculated by the attributable proportion due to interaction (AP). In addition, a register study was performed comprising all MS cases in Sweden who had received their diagnosis between 1993 and 2018 (n = 22 173), with 10 controls per case randomly selected from the National Population register. Residential air pollution was associated with MS risk. NOx levels (3-year average) exceeding the 90th percentile (24.6 µg/m3) were associated with an OR of 1.37 (95% CI 1.10-1.76) compared with levels below the 25th percentile (5.9 µg/m3), with a trend of increasing risk of MS with increasing levels of NOx (P <0.0001). A synergistic effect was observed between high NOx levels (exceeding the lower quartile among controls) and the HLA-DRB1*15:01 allele regarding MS risk (AP 0.26, 95% CI 0.13-0.29). Our findings indicate that moderate levels of combustion-related ambient air pollution may play a role in MS development.