This study aimed to evaluate the prevalence of restless legs syndrome (RLS) in patients with migraine and explore its association with vitamin D deficiency, aiming to provide biological support for the comorbidity of migraine with RLS, and shed new lights into clinical diagnosis and treatment. A case-control study was performed on 175 migraine patients and 151 non-headache controls. The information of all subjects concerning headache severity [visual analog scale (VAS) score], RLS, RLS severity [International Restless Legs Scale (IRLS) score], sleep quality [Pittsburgh sleep quality index (PSQI)], anxiety and depression symptoms [hospital anxiety and depression scale (HADS)], and demographic data were collected. At the same time, serum 25-(OH) D levels were also measured (concentration <20 ng/ml was defined deficiency). Afterward, the logistic regression model was adopted to explore the risk factors for RLS in patients with migraines. Compared with control group, migraine group had lower vitamin D levels [(21.10 ± 6.58) vs. (16.42 ± 5.6) ng/ml, < 0.001], a higher rate of vitamin D deficiency (45.03 vs. 72%, <0001), higher prevalence of RLS (6.62 vs. 22.29%, < 0.001). Compared with the pure RLS group, RLS with the migraine group had lower vitamin D levels and higher IRLS score ( < 0.05). Compared with pure migraine group, migraine with RLS group had lower vitamin D levels [(17.36 ± 5.56) vs. (13.15 ± 4.42) ng/ml, < 0.001], higher incidence of vitamin D deficiency (66.18 vs. 92.31%, = 0.001), higher frequency of headache attacks ( = 0.004). Thereafter, the multivariate logistic regression model was employed to adjust confounding factors such as age, gender, season, frequency of headache attacks, PSQI score, and HADS scores. According to the results vitamin D deficiency in patients with migraines was an independent risk factor for RLS (OR = 5.03, 95%CI: 1.2-21.16, = 0.027). The prevalence of RLS in migraine patients was significantly higher than that in the non-headache population. Besides, vitamin D levels decreased, while the incidence of vitamin D deficiency increased in the migraine patients complicated with RLS. Finally, the occurrence of RLS in migraine patients was significantly related to vitamin D deficiency.