You can’t prevent stomach cancer, but there are things you can do to lower your risk: Get proper treatment for Helicobacter pylori (H. pylori) if you test positive for it. This bacterial infection is a substantial risk factor for developing stomach cancer. Limit the consumption of alcohol and tobacco products. Change lifestyle or eating habits and maintain a healthy weight.