The host immune response is critical in Pneumocystis pneumonia (PCP). Immunocompetent hosts can eliminate the fungus without symptoms, while immunodeficient hosts develop PCP with an unsuitable excessive inflammatory response leading to lung damage. From studies based on rodent models or clinical studies, this review aimed to better understand the pathophysiology of Pneumocystis infection by analysing the role of immune cells, mostly lymphocytes, according to the immune status of the infected host. Hence, this review first describes the immune physiological response in infected immunocompetent hosts that are able to eliminate the fungus. The objective of the second part is to identify the immune elements required for the control of the fungus, focusing on specific immune deficiencies. Finally, the third part concentrates on the effect of the different immune elements in immunocompromised subjects during PCP, to better understand which cells are detrimental, and which, on the contrary, are beneficial once the disease has started. This work highlights that the immune response associated with a favourable outcome of the infection may differ according to the immune status of the host. In the case of immunocompetency, a close communication between B cells and TCD4 within tertiary lymphocyte structures appears critical to activate M2 macrophages without much inflammation. Conversely, in the case of immunodeficiency, a pro-inflammatory response including Th1 CD4, cytotoxic CD8, NK cells, and IFNγ release seems beneficial for M1 macrophage activation, despite the impact of inflammation on lung tissue.