Pneumonia is common and frequently fatal in HIV-infected patients, due to rampant, systemic inflammation and failure to control microbial infection. While airway microbiota composition is related to local inflammatory response, gut microbiota has been shown to correlate with the degree of peripheral immune activation (IL6 and IP10 expression) in HIV-infected patients. We thus hypothesized that both airway and gut microbiota are perturbed in HIV-infected pneumonia patients, that the gut microbiota is related to peripheral CD4+ cell counts, and that its associated products differentially program immune cell populations necessary for controlling microbial infection in CD4-high and CD4-low patients. To assess these relationships, paired bronchoalveolar lavage and stool microbiota (bacterial and fungal) from a large cohort of Ugandan, HIV-infected patients with pneumonia were examined, and in vitro tests of the effect of gut microbiome products on macrophage effector phenotypes performed. While lower airway microbiota stratified into three compositionally distinct microbiota as previously described, these were not related to peripheral CD4 cell count. In contrast, variation in gut microbiota composition significantly related to CD4 cell count, lung microbiota composition, and patient mortality. Compared with patients with high CD4+ cell counts, those with low counts possessed more compositionally similar airway and gut microbiota, evidence of microbial translocation, and their associated gut microbiome products reduced macrophage activation and IL-10 expression and increased IL-1β expression in vitro. These findings suggest that the gut microbiome is related to CD4 status and plays a key role in modulating macrophage function, critical to microbial control in HIV-infected patients with pneumonia.