To study the relationship of Vitamin D with innate and adaptive immune response parameters in chronic hepatitis B and C patients. The laboratory data between January 1, 2013 and February 1, 2023, for patients with chronic hepatitis B (CHB), and chronic hepatitis C (CHC) were extracted. Serum 25-hydroxyl vitamin D, hepatitis B virus serological markers, complements, and subsets of T lymphocytes were determined. Study cohorts were divided into groups based on serum 25-hydroxyl vitamin D levels with further evaluation of laboratory data. In CHB and CHC patients the percentage of CD4+ T lymphocytes and the CD4+/CD8+ ratio significantly decreased (P < 0.05), but the percentage of CD8+ increased (P < 0.05) compared to the control group. In CHB patients Vitamin D decrease was significant (P < 0.001) but not in CHC patients. Vitamin D showed a moderate negative influence on the CD8 cell count in CHB patients. The positive ratio of HBV DNA and HBsAg decreased with increasing serum vitamin D levels. The vitamin D deficient group showed significantly lower antibody production compared to the normal group, and exhibited significantly decreased CD4 numbers and increased CD8 numbers (P < 0.05 and P < 0.001, respectively), while the CD4/CD8 ratio was also significantly decreased in the insufficiency group (P < 0.001). Complement C3 levels were not associated with CD4 and CD8, but had an inverse relation with Vitamin D. Vitamin D levels were significantly associated with complement C3, CD8+, CD4+, CD19+ cells, and HBV DNA levels. Vitamin D may be a modulator of immune function not only via CD8+ and CD4+ cells but also via CD19+ cells in the course of chronic HBV infection. The negative relationship between vitamin D and complement C3 needs elucidation. Moreover, the increased proportion of B cells and decreased CD4+ cells in Vitamin D deficiency disrupt the immune response against HBV since the expected antibody response was not obtained despite the increase in B cell ratio. This indicates an influence of CD4+ cells for B cell functionality. In summary, sufficient levels of Vitamin D may lead to a sustained virological response that is debatable by artificially correcting the deficiency.