Cyclic di-AMP is the only known essential second messenger in bacteria and archaea, regulating different proteins indispensable for numerous physiological processes. In particular, it controls various potassium and osmolyte transporters involved in osmoregulation. In Bacillus subtilis, the K+/H+ symporter KimA of the KUP family is inactivated by c-di-AMP. KimA sustains survival at potassium limitation at low external pH by mediating potassium ion uptake. However, at elevated intracellular K+ concentrations, further K+ accumulation would be toxic. In this study, we reveal the molecular basis of how c-di-AMP binding inhibits KimA. We report cryo-EM structures of KimA with bound c-di-AMP in detergent solution and reconstituted in amphipols. By combining structural data with functional assays and molecular dynamics simulations we reveal how c-di-AMP modulates transport. We show that an intracellular loop in the transmembrane domain interacts with c-di-AMP bound to the adjacent cytosolic domain. This reduces the mobility of transmembrane helices at the cytosolic side of the K+ binding site and therefore traps KimA in an inward-occluded conformation.