The gastric mucosa can produce a very strong hydrochloric acid. Chemical substances, nervous signals, and hormones regulate the production of acid which is activated by the hormone gastrin and by signals from the vagus nerve which originates in the medulla oblongata of the brainstem. These signals liberate a substance from cells in the gastric mucosal cells - histamin - which is the most important initiator of gastric acid production.
The whole process is initiated when we eat. Just the anticipation, sight, smell, and taste of food start off the production of gastric acid. This is mediated through the vagus nerve. When the food enters the stomach, it stimulates the gastric mucosa both chemically and mechanically, e.g. by expanding the stomach.
Especially the protein part of the food promotes the production and liberation of the hormone gastrin which stimulates the production of acid. Once the food enters the upper part of the small intestine, both the production of gastrin and other hormone-like substances (pepsins) are stimulated and this further promotes the production of acid.
Gastric acid is also produced between meals and at night. This production has nothing to do with meals; it reaches a peak around midnight and is lowest around 7 am.
Consumption of both regular and decaffeinated coffee stimulates the production of gastric acid by liberating gastrin. Also beer and wine increase the production of gastric acid. When there is an adequate amount of acid in the stomach or if acid enters the duodenum, the productin of acid is inhibited. Fat in the duodenum has the same effect. Too much sugar in the blood and sweet drinks also inhibit the production of gastric acid.
Together with the digestive enzyme pepsin, gastric acid breaks down the food which thereafter enters the duodenum and moves further on to the rest of the small intestine where bile acids and digestive enzymes from the pancreas and small intestine take care of the further breakdown. The pepsin is produced when the gastric acid cleaves precursor - pepsinogens - into active pepsin which works best at an acid pH below 4.
Starchy foods such as bread, pasta, bisquits, and potatoes elevate the pH which results in problems with the breakdown and digestion of protein-rich foods like meat, poultry, eggs, and dairy products. This is the reason for the recommendation of a diet with separation of foodstuffs - also called the Fit for Life diet - in which these foods must not be eaten together but can be combined with neutral foods such as vegetables and salad plus fatty foods.
The production of gastric acid can be measured between meals and after stimulation with the hormone Pentagastrin. Especially in cases where there is suspicion of a large over-production of gastric acid in the Zollinger-Ellison syndrome and in cases where there is suspicion of a reduced gastric acid production, it could be interesting to measure the amount of gastric acid.