The combination of trimethoprim and sulfamethoxazole (TMP-SMX) is the most effective regimen for therapy of pneumonia (PCP). As many patients with PCP are allergic or do not respond to it, efforts have been devoted to develop alternative therapies for PCP. We have found that the combination of vitamin D (VitD3) (300 IU/kg/day) and primaquine (PMQ) (5 mg/kg/day) was as effective as TMP-SMX for therapy of PCP. In this study, we investigated the mechanisms by which vitamin D enhances the efficacy of PMQ. C57BL/6 mice were immunosuppressed by CD4 cell depletion, infected with for 8 weeks, and then treated for 9 days with the combination of VitD3 and PMQ (VitD3-PMQ) or with TMP-SMX or PMQ to serve as controls. The results showed that vitamin D supplementation increased the number of CD11c cells, suppressed the production of proinflammatory cytokines (tumor necrosis factor alpha [TNF-α], gamma interferon [IFN-γ], and interleukin-6 [IL-6]) and inducible nitric oxide synthase (iNOS), and enhanced the expression of genes related to antioxidation (glutathione reductase and glutamate-cysteine ligase modifier subunit), antimicrobial peptides (cathelicidin), and autophagy (ATG5 and beclin-1). These results suggest that the main action of vitamin D is enhancing the ability of the host to defend against infection.