Microglia are innate immune cells in the brain and show exceptional heterogeneity. They are key players in brain physiological development regulating synaptic plasticity and shaping neuronal networks. In pathological disease states, microglia‐induced synaptic pruning mediates synaptic loss and targeting microglia was proposed as a promising therapeutic strategy. However, the effect of microglia depletion and subsequent repopulation on dendritic spine density and neuronal function in the adult brain is largely unknown. In this study, we investigated whether pharmacological microglia depletion affects dendritic spine density after long‐term permanent microglia depletion and after short‐term microglia depletion with subsequent repopulation. Long‐term microglia depletion using colony‐stimulating‐factor‐1 receptor (CSF1‐R) inhibitor PLX5622 resulted in increased overall spine density, especially of mushroom spines, and increased excitatory postsynaptic current amplitudes. Short‐term PLX5622 treatment with subsequent repopulation of microglia had an opposite effect resulting in activated microglia with increased synaptic phagocytosis and consequently decreased spine density and reduced excitatory neurotransmission, while Barnes maze and elevated plus maze testing was unaffected. Moreover, RNA sequencing data of isolated repopulated microglia showed an activated and proinflammatory phenotype. Long‐term microglia depletion might be a promising therapeutic strategy in neurological diseases with pathological microglial activation, synaptic pruning, and synapse loss. However, repopulation after depletion induces activated microglia and results in a decrease of dendritic spines possibly limiting the therapeutic application of microglia depletion. Instead, persistent modulation of pathological microglia activity might be beneficial in controlling synaptic damage.