Neurons receive input from the outside world or from other neurons through neuronal receptive endings (NREs). Glia envelop NREs to create specialized microenvironments; however, glial functions at these sites are poorly understood. Here, we report a molecular mechanism by which glia control NRE shape and associated animal behavior. The C. elegans AMsh glial cell ensheathes the NREs of 12 neurons, including the thermosensory neuron AFD. KCC-3, a K/Cl transporter, localizes specifically to a glial microdomain surrounding AFD receptive ending microvilli, where it regulates K(+) and Cl(-) levels. We find that Cl(-) ions function as direct inhibitors of an NRE-localized receptor-guanylyl-cyclase, GCY-8, which synthesizes cyclic guanosine monophosphate (cGMP). High cGMP mediates the effects of glial KCC-3 on AFD shape by antagonizing the actin regulator WSP-1/NWASP. Components of this pathway are broadly expressed throughout the nervous system, suggesting that ionic regulation of the NRE microenvironment may be a conserved mechanism by which glia control neuron shape and function.