Phosphorus (P) is an essential component of core biological molecules. In bacteria, P is acquired mainly as inorganic orthophosphate (Pi) and assimilated into adenosine triphosphate (ATP) in the cytoplasm. Although P is essential, excess cytosolic Pi hinders growth. We now report that bacteria limit Pi uptake to avoid disruption of Mg2+-dependent processes that result, in part, from Mg2+ chelation by ATP. We establish that the MgtC protein inhibits uptake of the ATP precursor Pi when Salmonella enterica serovar Typhimurium experiences cytoplasmic Mg2+ starvation. This response prevents ATP accumulation and overproduction of ribosomal RNA that together ultimately hinder bacterial growth and result in loss of viability. Even when cytoplasmic Mg2+ is not limiting, excessive Pi uptake increases ATP synthesis, depletes free cytoplasmic Mg2+, inhibits protein synthesis, and hinders growth. Our results provide a framework to understand the molecular basis for Pi toxicity. Furthermore, they suggest a regulatory logic that governs P assimilation based on its intimate connection to cytoplasmic Mg2+ homeostasis.