Elevated levels of the second messenger cyclic dimeric GMP, c-di-GMP, promote transition of bacteria from single motile cells to surface-attached multicellular communities. Here we describe a post-translational mechanism by which c-di-GMP initiates this transition in enteric bacteria. High levels of c-di-GMP induce the counterclockwise bias in Escherichia coli flagellar rotation, which results in smooth swimming. Based on co-immunoprecipitation, two-hybrid and mutational analyses, the E. coli c-di-GMP receptor YcgR binds to the FliG subunit of the flagellum switch complex, and the YcgR-FliG interaction is strengthened by c-di-GMP. The central fragment of FliG binds to YcgR as well as to FliM, suggesting that YcgR-c-di-GMP biases flagellum rotation by altering FliG-FliM interactions. The c-di-GMP-induced smooth swimming promotes trapping of motile bacteria in semi-solid media and attachment of liquid-grown bacteria to solid surfaces, whereas c-di-GMP-dependent mechanisms not involving YcgR further facilitate surface attachment. The YcgR-FliG interaction is conserved in the enteric bacteria, and the N-terminal YcgR/PilZN domain of YcgR is required for this interaction. YcgR joins a growing list of proteins that regulate motility via the FliG subunit of the flagellum switch complex, which suggests that FliG is a common regulatory entryway that operates in parallel with the chemotaxis that utilizes the FliM-entryway.