Although biosensors for specific cellular ions are widely available, real-time monitoring of overall ionic strength in living organisms remains challenging. Here, we present a genetically encoded nuclear translocation ionic sensor (GENTIS) that enables direct visualization of ionic stress in vivo. Using this sensor alongside longitudinal tracking via an automated microfluidic platform, we find that Caenorhabditis elegans larvae experience highly synchronized, rhythmic elevations in intestinal ionic strength during the molt, a stage during which developmentally timed sleep occurs. Cytosolic proton accumulation through inhibition of vacuolar-type adenosine triphosphatases (V-ATPases) triggers GENTIS nuclear translocation and evokes behavioral quiescence, characterized by reduced feeding, locomotion, and activation of sleep-active neurons. Apical membrane V-ATPases naturally undergo disassembly during molting and stress, conditions that cause proton accumulation and sleep. Notably, this proton-linked sleep is suppressed by proton buffering with ammonium. Together, these findings establish GENTIS as a powerful tool for tracking ionic strength dynamics in vivo and reveal that proton ionic rhythms contribute to the regulation of sleep.