Aging is characterized by impaired immunity and unbalanced gut microbiota. Prebiotics have the capability to prevent or reverse age-related declines in health by modulating gut microbiota. Mushroom polysaccharides have been suggested to be potential prebiotics. However, their effects on the immunity and gut microbiota in aged mice have not been determined. This study firstly assessed the effects of a heteropolysaccharide L2 isolated from the fruit body of L. edodes on the immune response of aged mice, and then compared the composition of fecal microbiota in adult (N), old (O) and L2-treated old (Oa) mice using the high-throughput pyrosequencing technique. The results showed that L2 can restore the age-attenuated immune responses by increasing cytokine levels in peripheral blood. Moreover, L2 can partly reverse the age-altered composition of gut microbiota. The Euclidean distances (De) among 3 groups (N, O and Oa) are determined to be De(O, N) = 0.19, De(O, Oa) = 0.20, and De(N, Oa) = 0.10, i.e. there is a marked reduction in the distance from 0.19 to 0.1 by L2. This suggests the beneficial effects of L2 on enhancing immunity and improving gut health.