Phosphatases of regenerating liver (PRL-1, PRL-2, PRL-3; also known as PTP4A1, PTP4A2, PTP4A3, respectively) control intracellular magnesium levels by interacting with the CNNM magnesium transport regulators. Still, the exact mechanism governing magnesium transport by this protein complex is not well understood. Herein, we have developed a genetically encoded intracellular magnesium-specific reporter and demonstrate that the CNNM family inhibits the function of the TRPM7 magnesium channel. We show that the small GTPase ARL15 increases CNNM3/TRPM7 protein complex formation to reduce TRPM7 activity. Conversely, PRL-2 overexpression counteracts ARL15 binding to CNNM3 and enhances the function of TRPM7 by preventing the interaction between CNNM3 and TRPM7. Moreover, while TRPM7-induced cell signaling is promoted by PRL-1/2, it is reduced when CNNM3 is overexpressed. Lowering cellular magnesium levels reduces the interaction of CNNM3 with TRPM7 in a PRL-dependent manner, whereby knockdown of PRL-1/2 restores the protein complex formation. Cotargeting of TRPM7 and PRL-1/2 alters mitochondrial function and sensitizes cells to metabolic stress induced by magnesium depletion. These findings reveal the dynamic regulation of TRPM7 function in response to PRL-1/2 levels, to coordinate magnesium transport and reprogram cellular metabolism.