Microglia are the primary immune cells in the brain. Under physiological conditions, they typically stay in a "resting" state, with ramified processes continuously extending to and retracting from surrounding neural tissues. Whether and how such highly dynamic resting microglia functionally interact with surrounding neurons are still unclear. Using in vivo time-lapse imaging of both microglial morphology and neuronal activity in the optic tectum of larval zebrafish, we found that neuronal activity steers resting microglial processes and facilitates their contact with highly active neurons. This process requires the activation of pannexin-1 hemichannels on neurons. Reciprocally, such resting microglia-neuron contact reduces both spontaneous and visually evoked activities of contacted neurons. Our findings reveal an instructive role for neuronal activity in resting microglial motility and suggest the function for microglia in homeostatic regulation of neuronal activity in the healthy brain.