In a healthy gut, microbes are often aggregated with host mucus, yet the molecular basis for this organization and its impact on intestinal health are unclear. Mucus is a viscous physical barrier separating resident microbes from epithelia, but also provides glycan cues that regulate microbial behaviors. Using experimental evolution, we discovered a mucin-sensing pathway in an Aeromonas symbiont of zebrafish, Aer01. In response to the mucin-associated glycan N-acetylglucosamine, a sensor kinase regulates expression of a mucin-binding adhesin we named MbpA. When MbpA is disrupted, Aer01 colonizes to normal levels, but is largely planktonic and elicits increased intestinal inflammation, traits which are reversed by increasing cell surface MpbA. MbpA-like adhesins are common in human-associated bacteria and expression of an Akkermansia muciniphila MbpA-like adhesin in MbpA-deficient Aer01 restored lumenal aggregation and reversed its pro-inflammatory character. Our work demonstrates how resident bacteria use mucin glycans to modulate behaviors congruent with host health.