The use of acid-suppressive drugs to combat digestive disorders increases the risk of pneumonia, researchers say.
Many people visit doctors suffering heartburn
The drugs work by restricting the production of acid in the stomach.
But researchers from Radboud University in Nijmegen, Netherlands, found they increased the risk of pneumonia by 27% in a study of 364,000 people.
One in 20 people visit UK doctors each year complaining of heartburn, and many are prescribed acid-suppressive drugs to alleviate stomach acid build-up.
The drugs are commonly used for gastrointestinal diseases such as gastroesohageal reflux disease, the backflow of acid from the stomach into the oesophagus, which affects about one in 50 people.
But doctors also prescribe them for severe indigestion.
The market for acid-suppressive drugs, such as proton pump inhibitors or H2-receptor antagonists drugs, is worth more than £7bn a year.
It is thought the pneumonia risk is associated with the increase in stomach bacteria, which is normally killed by the acid.
Co-author Dr Robert Laheij, from the university, said the drugs were extremely effective but did carry a risk.
"I would not say to people stop using them but they should be careful.
"A lot of people carry on using them when they do not have the symptoms any more, and that is a concern.
"Quite often symptoms fluctuate. People should only use them when necessary."
One alternative to the drugs is antacids, which work by neutralising acid, but Dr Laheij said they were not as effective.
Of the 364,000 people studied during the seven-year study, 5,551 people had pneumonia - 477 of whom developed it during or after taking acid-suppressive medication, the Journal of the American Medical Association reported.
In an editorial for the journal, James Gregor, from the University of Western Ontario in Canada, said: "If acid suppression causes some cases of pneumonia, it is reassuring that the risk is relatively small and that the complication in most cases is usually amenable to therapy.
"However, no medication is without potential adverse effects."
And Dr Martin Sarner, the honorary secretary of Core, formerly the Digestive Disorders Foundation, said the risk of pneumonia had always been there in theory because the therapy reduces acid production.
But he said: "The drugs also have other side effects such as headaches and diarrhoea, but they are very effective and continue to be used."