A slimy, hydrated mucus gel lines all wet epithelia in the human body, including the eyes, lungs, and gastrointestinal and urogenital tracts. Mucus forms the first line of defence while housing trillions of microorganisms that constitute the microbiota1. Rarely do these microorganisms cause infections in healthy mucus1, suggesting that mechanisms exist in the mucus layer that regulate virulence. Using the bacterium Pseudomonas aeruginosa and a three-dimensional (3D) laboratory model of native mucus, we determined that exposure to mucus triggers downregulation of virulence genes that are involved in quorum sensing, siderophore biosynthesis and toxin secretion, and rapidly disintegrates biofilms-a hallmark of mucosal infections. This phenotypic switch is triggered by mucins, which are polymers that are densely grafted with O-linked glycans that form the 3D scaffold inside mucus. Here, we show that isolated mucins act at various scales, suppressing distinct virulence pathways, promoting a planktonic lifestyle, reducing cytotoxicity to human epithelia in vitro and attenuating infection in a porcine burn model. Other viscous polymer solutions lack the same effect, indicating that the regulatory function of mucin does not result from its polymeric structure alone. We identify that interactions with P. aeruginosa are mediated by mucin-associated glycans (mucin glycans). By isolating glycans from the mucin backbone, we assessed the collective activity of hundreds of complex structures in solution. Similar to their grafted counterparts, free mucin glycans potently regulate bacterial phenotypes even at relatively low concentrations. This regulatory function is likely dependent on glycan complexity, as monosaccharides do not attenuate virulence. Thus, mucin glycans are potent host signals that 'tame' microorganisms, rendering them less harmful to the host.