Endoplasmic reticulum (ER) stress is related to oxidative stress (OS) and leads to intestinal injury. Bacillus amyloliquefaciens SC06 (SC06) can regulate OS, but its roles in intestinal ER stress remains unclear. Using a 2 × 2 factorial design, 32 weaned piglets were treated by two SC06 levels (0 or 1 × 108 CFU/g), either with or without diquat (DQ) injection. We found that SC06 increased growth performance, decreased ileal permeability, OS and ER stress in DQ-treated piglets. Transcriptome showed that differentially expressed genes (DEGs) induced by DQ were enriched in NF-κB signaling pathway. DEGs between DQ- and SC06 + DQ-treated piglets were enriched in glutathione metabolism pathway. Ileal microbiome revealed that the SC06 + DQ treatment decreased Clostridium and increased Actinobacillus. Correlations were found between microbiota and ER stress genes. In conclusion, dietary SC06 supplementation increased the performance, decreased the permeability, OS and ER stress in weaned piglets by regulating ileal genes and microbiota.