Neuronal networks operate over a wide range of activity levels, with both neuronal and nonneuronal cells contributing to the balance of excitation and inhibition. Activity imbalance within neuronal networks underlies many neurological diseases, such as epilepsy. The Caenorhabditis elegans locomotor circuit operates via coordinated activity of cholinergic excitatory and GABAergic inhibitory transmission. We have previously shown that a gain-of-function mutation in a neuronal acetylcholine receptor, acr-2(gf), causes an epileptic-like convulsion behavior. Here we report that the behavioral and physiological effects of acr-2(gf) require the activity of the TRPM channel GTL-2 in nonneuronal tissues. Loss of gtl-2 function does not affect baseline synaptic transmission but can compensate for the excitation-inhibition imbalance caused by acr-2(gf). The compensatory effects of removing gtl-2 are counterbalanced by another TRPM channel, GTL-1, and can be recapitulated by acute treatment with divalent cation chelators, including those specific for Zn(2+). Together, these data reveal an important role for ion homeostasis in the balance of neuronal network activity and a novel function of nonneuronal TRPM channels in the fine-tuning of this network activity.