Tuberculosis is highly infectious and has a high incidence worldwide. Therefore, effective treatment is essential for the disease. The immune function and inflammatory factors can reflect the therapeutic effect of pulmonary tuberculosis to some extent. Thus, the aim of the present study was to investigate the clinical effect of vitamin D supplementation on pulmonary tuberculosis patients and its influence on the expression of immune cells and inflammatory factors in patients. A total of 256 patients with pulmonary tuberculosis who were admitted to our hospital were collected as research participants; 120 patients who were treated with conventional antituberculosis drugs were taken as a control group (CG) and 136 patients who were treated with vitamin D-assisted antituberculosis drugs were taken as the research group (RG). The levels of inflammatory factors (IL-6, MMP-9, IL-4, TNF-α) and T lymphocyte subgroup of patients were measured in both groups before and after treatment. The efficacy was compared in both groups. The disappearance time of wheezing and cough in RG was shorter than that in CG (P<0.001). There was no difference in X-ray chest plain film, sputum examination results and efficacy of patients in both groups (P>0.05). After treatment, CD3
+
, CD4
+
, CD4
+
/CD8
+
were upregulated in both groups (P<0.05), while CD3
+
, CD4
+
, CD4
+
/CD8
+
in RG were higher than those in CG (P<0.05). After treatment, inflammatory factors in both groups improved compared with those before treatment. Serum inflammatory factors in RG were significantly lower than those in CG (P<0.05). After treatment, surfactant protein in the two groups was lower than that before treatment, while that in RG was significantly lower than that in CG (P<0.05). After treatment, soluble selectins in both groups improved significantly. The level of soluble selectins in RG was slightly lower than that in CG. The incidence of adverse reactions in RG was lower than that in CG. The life quality scores of patients in RG were slightly higher than those in CG (P<0.05). In conclusion, vitamin D-assisted antituberculosis drugs can effectively improve the immune function and expression level of inflammatory factors in pulmonary tuberculosis patients and reduce adverse reactions.