When the gas pressure is too high, the diaphragm pushes against the spring, causing the valve to close slightly, reducing the flow of gas. Conversely, if the pressure drops below a certain threshold, the diaphragm allows the valve to open wider, permitting more gas to flow through. This continuous adjustment process ensures that the output pressure remains steady, regardless of fluctuations in supply pressure.