Phosphatases of regenerating liver (PRL-1, PRL-2, and PRL-3, also known as PTP4A1, PTP4A2, and PTP4A3) control magnesium homeostasis through an association with the CNNM magnesium transport regulators. Although high PRL levels have been linked to cancer progression, regulation of their expression is poorly understood. Here we show that modulating intracellular magnesium levels correlates with a rapid change of PRL expression by a mechanism involving its 5′UTR mRNA region. Mutations or CRISPR-Cas9 targeting of the conserved upstream ORF present in the mRNA leader derepress PRL protein synthesis and attenuate the translational response to magnesium levels. Mechanistically, magnesium depletion reduces intracellular ATP but up-regulates PRL protein expression via activation of the AMPK/mTORC2 pathway, which controls cellular energy status. Hence, altered PRL-2 expression leads to metabolic reprogramming of the cells. These findings uncover a magnesium-sensitive mechanism controlling PRL expression, which plays a role in cellular bioenergetics.