Bacteriorhodopsin pumps protons across a membrane using the energy of light. The proton pumping is inhibited when the transmembrane proton gradient that the protein generates becomes larger than four pH units. This phenomenon is known as the back-pressure effect. Here, we investigate the structural basis of this effect by predicting the influence of a transmembrane pH gradient on the titration behavior of bacteriorhodopsin. For this purpose we introduce a method that accounts for a pH gradient in protonation probability calculations. The method considers that in a transmembrane protein, which is exposed to two different aqueous phases, each titratable residue is accessible for protons from one side of the membrane depending on its hydrogen-bond pattern. This method is applied to several ground-state structures of bacteriorhodopsin, which residues already present complicated titration behaviors in the absence of a proton gradient. Our calculations show that a pH gradient across the membrane influences in a non-trivial manner the protonation probabilities of six titratable residues which are known to participate in the proton transfer: D85, D96, D115, E194, E204, and the Schiff base. The residues connected to one side of the membrane are influenced by the pH on the other side because of their long-range electrostatic interactions within the protein. In particular, D115 senses the pH at the cytoplasmic side of the membrane and transmits this information to D85 and the Schiff base. We propose that the strong electrostatic interactions found between D85, D115, and the Schiff base as well as the interplay of their respective protonation states under the influence of a transmembrane pH gradient are responsible for the back-pressure effect on bacteriorhodopsin.