One way to treat ulcers is to get rid of the H. pylori bacteria (which is its cause). Treatment may also be aimed at lowering the amount of acid that your stomach makes, neutralizing the acid and protecting the injured area so it can heal. It's also very important to stop doing things, such as smoking and drinking alcohol, that damage the lining of your digestive tract.
Antibiotics are used to kill the H. pylori bacteria.
Several other medicines can be used to help treat ulcers. Two types of medicines (H2 blockers and proton pump inhibitors) reduce the amount of acid that your stomach makes. They usually help people start to feel better within 3 days.
Antacids neutralize acid that the stomach makes. A medicine called sucralfate coats the ulcer to protect it from the acid so it has time to heal.
Another medicine, misoprostol, reduces the amount of acid and protects the lining of the stomach. It is usually used to prevent gastric ulcers in people who need to take anti-inflammatory drugs and who have had stomach irritation or ulcers in the past.
In very rare cases that do not respond to medication or if there are complications, surgery may be required to treat a peptic ulcer.