Helicobacter pylori is the primary cause of gastric adenocarcinoma, which afflicts more than half of the world's population and seriously affects human health. However, achieving efficient treatment of H. pylori infection by effective drug delivery and bioavailability after oral administration remains a challenge due to the harsh microenvironment, short drug retention time, and physiological barriers in the stomach. Moreover, H. pylori has shown resistance to many clinical antibiotics. Antimicrobial peptides (AMPs) exhibit substantial therapeutic efficacy against H. pylori, while they are not likely to induce drug resistance, suggesting their potential utility for the treatment of diseases related to H. pylori . In this paper, we report the design and synthesis of an AMP (GE33) hydrogel with pH-responsive and controlled peptide release properties, in which the minimal inhibitory concentration of the AMP against H. pylori is as low as 1 μg/mL. GE33 self-assembles into a stable peptide hydrogel under neutral pH conditions but decomposes into monomers or oligomers under acidic conditions. Upon oral administration of the hydrogel, the acidic gastric environment would facilitate rapid release of active AMP molecules from the hydrogel and immediate targeting of H. pylori in the stomach wall. Additionally, the remaining peptide is protected in the hydrogel, extending its retention time in the stomach, so that persistent drug release is achieved. The controlled and sustained release manner of the active molecule GE33, which enhances drug bioavailability, along with its excellent bactericidal efficacy opens a great potential for treating H. pylori infection.