Tripartite resistance nodulation and cell division multidrug efflux pumps span the periplasm and are major drivers of multidrug resistance among Gram-negative bacteria. Cations, such as Mg2+, become concentrated within the periplasm and, in contrast to the cytoplasm, it’s pH is sensitive to conditions outside the cell. Here, we reveal an interplay between Mg2+ and pH in modulating the structural dynamics of the periplasmic adaptor protein, AcrA, and its function within the prototypical AcrAB-TolC multidrug pump from Escherichia coli. In the absence of Mg2+, AcrA becomes increasingly plastic within acidic conditions, but when Mg2+ is bound this is ameliorated, resulting instead in domain specific organisation. We establish a unique histidine residue directs these dynamics and is essential for sustaining pump activity across acidic, neutral, and basic regimes. Overall, we propose Mg2+ conserves AcrA structural mobility to ensure optimal AcrAB-TolC function within rapid changing environments commonly faced during bacterial infection and colonization.