Previous studies demonstrate that Mycobacterium vaccae NCTC 11659 (M. vaccae), a soil-derived bacterium with anti-inflammatory and immunoregulatory properties, is a potentially useful countermeasure against negative outcomes to stressors. Here we used male C57BL/6NCrl mice to determine if repeated immunization with M. vaccae is an effective countermeasure in a “two hit” stress exposure model of chronic disruption of rhythms (CDR) followed by acute social defeat (SD). On day –28, mice received implants of biotelemetric recording devices to monitor 24-h rhythms of locomotor activity. Mice were subsequently treated with a heat-killed preparation of M. vaccae (0.1 mg, administered subcutaneously on days –21, –14, –7, and 27) or borate-buffered saline vehicle. Mice were then exposed to 8 consecutive weeks of either stable normal 12:12 h light:dark (LD) conditions or CDR, consisting of 12-h reversals of the LD cycle every 7 days (days 0–56). Finally, mice were exposed to either a 10-min SD or a home cage control condition on day 54. All mice were exposed to object location memory testing 24 h following SD. The gut microbiome and metabolome were assessed in fecal samples collected on days –1, 48, and 62 using 16S rRNA gene sequence and LC-MS/MS spectral data, respectively; the plasma metabolome was additionally measured on day 64. Among mice exposed to normal LD conditions, immunization with M. vaccae induced a shift toward a more proactive behavioral coping response to SD as measured by increases in scouting and avoiding an approaching male CD-1 aggressor, and decreases in submissive upright defensive postures. In the object location memory test, exposure to SD increased cognitive function in CDR mice previously immunized with M. vaccae. Immunization with M. vaccae stabilized the gut microbiome, attenuating CDR-induced reductions in alpha diversity and decreasing within-group measures of beta diversity. Immunization with M. vaccae also increased the relative abundance of 1-heptadecanoyl-sn-glycero-3-phosphocholine, a lysophospholipid, in plasma. Together, these data support the hypothesis that immunization with M. vaccae stabilizes the gut microbiome, induces a shift toward a more proactive response to stress exposure, and promotes stress resilience.