Q: I’ve had heartburn for years, and I began taking Prilosec as soon as it became available. It gives me relief, but I worry about taking any drug for a long time. Should I be worried?

A: As I’ve often said, no drug is 100 percent safe. That doesn’t mean that you shouldn’t take one if you need it. But you should continually weigh the risks and benefits.

Prilosec is a proton pump inhibitor, a drug that reduces stomach acid. We need stomach acid to help digest food, but if too much of it is produced, it can inflame and irritate the esophagus, causing heartburn. (Recurring heartburn is called gastroesophageal reflux disease, or GERD.) It can also cause ulcers in the stomach and small intestine.

PPIs are the most commonly prescribed drugs for acid reflux and heartburn. They include omeprazole (Prilosec), esomeprazole (Nexium), lansoprazole (Prevacid), pantroprazole (Protonix) and three other medicines. The four PPI drugs that I’ve mentioned have other brand names in addition to the ones listed.

So, like you, many people take PPIs. Also like you, people often take PPIs every day for years. This makes sense if you have a chronic problem with stomach acid, but the occasional case of mild heartburn does not need to be treated with a PPI.

For that kind of spot duty, antacid medicines such as Tums, Rolaids and Maalox will likely do the trick. They directly counteract acid in your stomach. So will drugs like cimetidine (Tagamet), famotidine (Pepcid) and ranitidine (Zantac). Like the PPIs, these drugs cause your stomach to make less acid, but they work faster than PPIs.

You can also tackle your heartburn with changes that don’t involve taking any medicine. Eat smaller meals and cut back on alcohol. If you’re heavy, lose weight. Raising the head of your bed should also help.

As a long-term PPI user, you should consider the possible drug interactions and side effects of PPIs. They may decrease the effectiveness of clopidogrel (Plavix, others), a medication that helps prevent artery-clogging blood clots.

In addition, people taking PPIs seem to be more likely to get pneumonia than those who aren’t. That’s because some cases of pneumonia are caused when stomach contents are regurgitated up into the throat, and then drop down into the lungs. Since acid kills bacteria, stomach contents that are low in acid are more likely to contain bacteria.

Stomach acid also helps you absorb calcium in your diet. Theoretically, that might mean that long-term use of PPIs would make you vulnerable to thin bones (osteopenia or osteoporosis). However, the evidence for that is weak.

Experts do not recommend, for example, that people taking long-term PPIs get bone density tests, or take calcium pills. However, I’d advise you to eat calcium-rich foods.

Even if you have a prescription for a PPI, you and your doctor should review the reasons for it periodically to make sure they’re still valid.

If you do need that prescription — and many people do — it should be for the lowest effective dose.

• Dr. Komaroff is a physician and professor at Harvard Medical School. For questions, go to AskDoctorK.com.