f Pathogenic bacteria often need to survive in the host and the environment, and it is not well understood how cells transition between these equally challenging situations. For the human and animal pathogen Salmonella enterica serovar Typhimurium, biofilm formation is correlated with persistence outside a host, but the connection to virulence is unknown. In this study, we analyzed multicellular-aggregate and planktonic-cell subpopulations that coexist when S. Typhimurium is grown under biofilminducing conditions. These cell types arise due to bistable expression of CsgD, the central biofilm regulator. Despite being exposed to the same stresses, the two cell subpopulations had 1,856 genes that were differentially expressed, as determined by transcriptome sequencing (RNA-seq). Aggregated cells displayed the characteristic gene expression of biofilms, whereas planktonic cells had enhanced expression of numerous virulence genes. Increased type three secretion synthesis in planktonic cells correlated with enhanced invasion of a human intestinal cell line and significantly increased virulence in mice compared to the aggregates. However, when the same groups of cells were exposed to desiccation, the aggregates survived better, and the competitive advantage of planktonic cells was lost. We hypothesize that CsgD-based differentiation is a form of bet hedging, with single cells primed for host cell invasion and aggregated cells adapted for persistence in the environment. This allows S. Typhimurium to spread the risks of transmission and ensures a smooth transition between the host and the environment.