Brain metastases are prevalent in various types of cancer and are often terminal, given the low efficacy of available therapies. Therefore, preventing them is of utmost clinical relevance, and prophylactic treatments are perhaps the most efficient strategy. Here, we show that systemic prophylactic administration of a toll-like receptor (TLR) 9 agonist, CpG-C, is effective against brain metastases. Acute and chronic systemic administration of CpG-C reduced tumor cell seeding and growth in the brain in three tumor models in mice, including metastasis of human and mouse lung cancer, and spontaneous melanoma-derived brain metastasis. Studying mechanisms underlying the therapeutic effects of CpG-C, we found that in the brain, unlike in the periphery, natural killer (NK) cells and monocytes are not involved in controlling metastasis. Next, we demonstrated that the systemically administered CpG-C is taken up by endothelial cells, astrocytes, and microglia, without affecting blood-brain barrier (BBB) integrity and tumor brain extravasation. In vitro assays pointed to microglia, but not astrocytes, as mediators of CpG- C effects through increased tumor killing and phagocytosis, mediated by direct microglia-tumor contact. In vivo, CpG-C-activated microglia displayed elevated mRNA expression levels of apoptosis-inducing and phagocytosis-related genes. Intravital imaging showed that CpG-C-activated microglia cells contact, kill, and phagocytize tumor cells in the early stages of tumor brain invasion more than nonactivated microglia. Blocking in vivo activation of microglia with minocycline, and depletion of microglia with a colony-stimulating factor 1 inhibitor, indicated that microglia mediate the antitumor effects of CpG-C. Overall, the results suggest prophylactic CpG-C treatment as a new intervention against brain metastasis, through an essential activation of microglia.