The aboveground parts of terrestrial plants, collectively called the phyllosphere, have a key role in the global balance of atmospheric carbon dioxide and oxygen. The phyllosphere represents one of the most abundant habitats for microbiota colonization. Whether and how plants control phyllosphere microbiota to ensure plant health is not well understood. Here we show that the Arabidopsis quadruple mutant (min7 fls2 efr cerk1; hereafter, mfec)1, simultaneously defective in pattern-triggered immunity and the MIN7 vesicle-trafficking pathway, or a constitutively activated cell death1 (cad1) mutant, carrying a S205F mutation in a membrane-attack-complex/perforin (MACPF)-domain protein, harbour altered endophytic phyllosphere microbiota and display leaf-tissue damage associated with dysbiosis. The Shannon diversity index and the relative abundance of Firmicutes were markedly reduced, whereas Proteobacteria were enriched in the mfec and cad1S205F mutants, bearing cross-kingdom resemblance to some aspects of the dysbiosis that occurs in human inflammatory bowel disease. Bacterial community transplantation experiments demonstrated a causal role of a properly assembled leaf bacterial community in phyllosphere health. Pattern-triggered immune signalling, MIN7 and CAD1 are found in major land plant lineages and are probably key components of a genetic network through which terrestrial plants control the level and nurture the diversity of endophytic phyllosphere microbiota for survival and health in a microorganism-rich environment. Mutations in genes involved in immune signalling and vesicle trafficking cause defects in the leaf microbiome of Arabidopsis thaliana that result in damage to leaf tissues, suggesting mechanisms by which terrestrial plants control the level and diversity of endophytic phyllosphere microbiota.