Cerebral cavernous malformations (CCMs) are a cause of stroke and seizure for which no effective medical therapies yet exist. CCMs arise from the loss of an adaptor complex that negatively regulates MEKK3-KLF2/4 signalling in brain endothelial cells, but upstream activators of this disease pathway have yet to be identified. Here we identify endothelial Toll-like receptor 4 (TLR4) and the gut microbiome as critical stimulants of CCM formation. Activation of TLR4 by Gram-negative bacteria or lipopolysaccharide accelerates CCM formation, and genetic or pharmacologic blockade of TLR4 signalling prevents CCM formation in mice. Polymorphisms that increase expression of the TLR4 gene or the gene encoding its co-receptor CD14 are associated with higher CCM lesion burden in humans. Germ-free mice are protected from CCM formation, and a single course of antibiotics permanently alters CCM susceptibility in mice. These studies identify unexpected roles for the microbiome and innate immune signalling in the pathogenesis of a cerebrovascular disease, as well as strategies for its treatment.