PPIs work by inhibiting certain stomach cells from "pumping" acid into the stomach. When taken 30 to 60 minutes before a meal, PPIs can prevent or reduce heartburn. However, they do not work as well when taken on demand as they do when taken over a period of time.