Purpose Concomitant vitamin D deficiency (VDD) is speculated to aggravate diabetic macular edema (DME). We aimed to determine the effect of hypovitaminosis D correction on the outcome of treatment with intravitreal bevacizumab (IVB) in DME eyes. Methods In this randomized clinical trial, 83 eyes of 83 patients with DME were recruited and divided into three groups: normal vitamin D levels + IVB administration (Group 1), vitamin D insufficient/deficient + IVB administration (Group 2), and vitamin D insufficient/deficient + IVB administration + oral vitamin D supplementation (Group 3). Participants were followed for 6 months after the intervention. Visual (corrected distance visual acuity, CDVA) and anatomical (central macular thickness, CMT) outcomes of intervention were evaluated 1, 3, and 6 months after three monthly loading doses of IVB were given. Serum vitamin D levels were measured 1 and 6 months after the third IVB administration. Results A total of 29, 26, and 28 eyes were enrolled in groups 1, 2, and 3, respectively. In months 1, 3, and 6, after the three basic loading doses of IVB, visual acuity and CMT improved in all three groups, but improvements (both functional and anatomical) in groups 1 and 3 in month 6 were more significant than in group 2 (mean CDVA LogMAR changes: - 0.18 +/- 0.03, - 0.14 +/- 0.05, and - 0.2 +/- 0.06; mean CMT reductions: - 82.24 +/- 11.43, - 66.62 +/- 14.34, and - 86.14 +/- 18.36, in groups 1, 2, and 3, respectively; p < 0.001). The mean number of IVB injections during follow-up was 5.33 (range 4-7), which did not differ between the groups. Conclusion Correction of vitamin D deficiency in DME patients with type 2 diabetes and vitamin D deficiency, in addition to IVB injections, may play a role in improving CDVA and CMT. However, this beneficial effect seems to be delayed by several months.