Gastritis that is caused by H.pylori infection in the digestive tract is treated by a regimen of antibiotics such as biaxin and flagyl, which kill the bacteria, explains Mayo Clinic. A patient needs to complete the prescription, which usually lasts for about 14 days.