Although Pneumocystis infection might be one of the causes of secondary pulmonary alveolar proteinosis (PAP), the mechanism of its pathogenesis is uncertain. We analyzed a mouse model of secondary PAP resulting from Pneumocystis infection using mice deficient in CD40 (CD40KO), and evaluated the mechanism of the pathogenesis of secondary PAP from the viewpoint of surfactant-associated protein (SP) homeostasis, the overproduction of SP by type II alveolar epithelial cells, and the phagocytic function of alveolar macrophages (AMs). The effect of CD40 on SP production was also investigated in vitro using the H441 cell line, which has a phenotype similar to type II alveolar epithelial cells and primary alveolar epithelial cells. After long-term exposure to ovalbumin, CD40KO mice showed Pneumocystis infection and accumulation of surfactants in the alveoli (ApCD40KO). The amounts of SP production were up-regulated in ApCD40KO mice compared with wild-type mice treated using the same procedure. On the other hand, AMs from ApCD40KO mice did not show either phagocytic dysfunction or down-regulation of PU.1 expression. Furthermore, the stimulation of CD40-CD40 ligand (CD154) pathway regulated the production of SPs in H441 cells or primary alveolar epithelial cells. These results suggested that CD40KO mice could be one of the models useful for developing secondary PAP resulting from Pneumocystis infection. Surfactant accumulation was due to the overproduction in our model of secondary PAP. The CD40-CD154 interaction plays an important role in the regulation of surfactant-associated protein production.