The aim of this study was to determine the effects of Mycobacterium phlei in diets (Experiment 1) and investigate the mode of action on the intestinal microecology of weaned piglets (Experiments 1 and 2). In Experiment 1, a total of 96 commercial cross-bred pigs [(Duroc × Yorkshire) × Landrace], weaned at 21 days, were assigned to two treatments in a completely randomized design with a single factorial arrangement of 40 days of supplementation (nonsupplemented vs. supplemented with 0.4% heat-killed M. phlei). The results showed that M. phlei has the capability to improve the intestinal microecology of weaned piglets. The serum concentrations of IL-2, IL-12, and TNF-α from the experimental group were significantly higher than in the control group (P < 0.01). In Experiment 2, the antibacterial effect of 5 different extracts (pure water, 95% ethanol, chloroform, ethyl acetate, and n-butanol) from M. phlei was assayed by the Plat stiletto method. The results showed that these extracts had hardly any antibacterial effect on E. coli. Our results indicate that M. phlei can improve the intestinal microecology of weaned piglets not because of its antibacterial effects, but because of these immune factors stimulated by the microecology of weaned piglets.