The highly motile human pathogen Helicobacter pylori lives deep in the gastric mucus layer. To identify which chemical gradient guides the bacteria within the mucus layer, combinations of luminal perfusion, dialysis, and ventilation were used to modify or invert transmucus gradients in anaesthetized Helicobacter-infected mice and Mongolian gerbils. Neither changes in lumen or arterial pH nor inversion of bicarbonate/CO2 or urea/ammonium gradients disturbed Helicobacter orientation. However, elimination of the mucus pH gradient by simultaneous reduction of arterial pH and bicarbonate concentration perturbed orientation, causing the bacteria to spread over the entire mucus layer. H. pylori thus uses the gastric mucus pH gradient for chemotactic orientation.