Helicobacter pylori is a highly prevalent pathogen in human gastric mucosa epithelial cells with strong colonization ability. Weizmannia coagulans is a kind of active microorganism that is beneficial to the improvement of host gut microbiota balance and can prevent and treat intestinal diseases. We investigated the beneficial effects of W. coagulans BC99 in H. pylori infected mice and measured inflammation response, oxidative stress, and gut microbiota. Results showed that BC99 could alleviate the gastric inflammation, inhibit the increasing of inflammation parameters endotoxin, interleukin‐10, transforming growth factor‐β, and interferon‐γ and oxidative stress myeloperoxidase and malondialdehyde, promote the levels of superoxide dismutase and catalase. Furthermore, 16S rRNA gene sequencing analysis revealed that BC99 reversed the change of gut microbiota by reducing the abundance of Olsenella, Candidatus_Saccharimonas, Monoglobus, and increasing the abundance of Tyzzerella. Meanwhile, BC99 caused elevated levels of Ligilactobacillus and Lactobacillus. In view of the beneficial effect of BC99 on the content of short‐chain fatty acid, valeric acid with sodium valerate interfered with H. pylori infection in mice found that valeric acid had a good restorative effect of H. pylori infection relating inflammation and oxidative stress responses. These results suggest that W. coagulans BC99 can be used as a potential probiotic to prevent and treat H. pylori infection by regulating the inflammation, oxidative stress, and gut microbiota.