Microglia and astrocytes clear neuronal debris after stroke, whether glia remain phagocytic and cause synapse loss at the subacute stage remains unknown. Here, the authors show in a murine model of ischemic stroke that inhibition of phagocytosis by MEGF10 and MERTK deletion in microglia and astrocytes attenuated damage and improved neurological outcomes by preventing synapse loss. The pathological role of reactive gliosis in CNS repair remains controversial. In this study, using murine ischemic and hemorrhagic stroke models, we demonstrated that microglia/macrophages and astrocytes are differentially involved in engulfing synapses in the reactive gliosis region. By specifically deleting MEGF10 and MERTK phagocytic receptors, we determined that inhibiting phagocytosis of microglia/macrophages or astrocytes in ischemic stroke improved neurobehavioral outcomes and attenuated brain damage. In hemorrhagic stroke, inhibiting phagocytosis of microglia/macrophages but not astrocytes improved neurobehavioral outcomes. Single-cell RNA sequencing revealed that phagocytosis related biological processes and pathways were downregulated in astrocytes of the hemorrhagic brain compared to the ischemic brain. Together, these findings suggest that reactive microgliosis and astrogliosis play individual roles in mediating synapse engulfment in pathologically distinct murine stroke models and preventing this process could rescue synapse loss.