Intestinal diseases caused by physiological stress have become a severe public health threat worldwide. Disturbances in the gut microbiota-host relationship have been associated with irritable bowel disease (IBD), while melatonin (MT) has antiinflammatory and antioxidant effects. The objective of this study was to investigate the mechanisms by which MT-mediated protection mitigated stress-induced intestinal microbiota dysbiosis and inflammation. We successfully established a murine restraint stress model with and without MT supplementation. Mice subjected to restraint stress had significantly elevated corticosterone (CORT) levels, decreased MT levels in their plasma, elevated colonic ROS levels and increased bacterial abundance, including Bacteroides and Tyzzerella, in their colon tract, which led to elevated expression of Toll-like receptor (TLR) 2/4, p-P65 and p-IκB. In contrast, supplementation with 20 mg/kg MT reversed the elevation of the plasma CORT levels, downregulated the colon ROS levels and inhibited the changes in the intestinal microbiota induced by restraint stress. These effects, in turn, inhibited the activities of TLR2 and TLR4, p-P65 and p-IκB, and decreased the inflammatory reaction induced by restraint stress. Our results suggested that MT may mitigate “restraint stress”-induced colonic microbiota dysbiosis and intestinal inflammation by inhibiting the activation of the NF-κB pathway.