Gut microbiota in HIV–pneumonia patients is related to peripheral CD4 counts, lung microbiota, and in vitro macrophage dysfunction. Here, CD4 is linked to susceptibility to pneumonia measurement.