Agar oligosaccharide (AOS) is a new kind of marine functional oligosaccharide with generous biological activities. To investigate the antioxidative effects of AOS in vivo, 3 % aqueous hydrogen peroxide (H2O2) was used to induce oxidative stress in male Drosophila melanogaster (D. melanogaster) fed 5 % sucrose (SUC). AOS (0.125 %) in the medium extended the lifespan of D. melanogaster suffering from oxidative stress by improving antioxidant capacity and intestinal function. Electron microscopic observation of epithelial cells showed that AOS alleviated the damage caused by H2O2 challenge in the intestine of D. melanogaster, including a reduction of gut leakage and maintenance of intestinal length and cell ultrastructure. The Keap1-Nrf2 (analogues of CncC gene in D. melanogaster) signaling pathway was significantly activated based on gene expression levels and a reduction in ROS content in the intestine of D. melanogaster suffering from oxidative stress. The improvement of antioxidant capacity may be related to the regulation of intestinal microflora with AOS supplementation for D. melanogaster. Nrf2-RNAi, sterile and gnotobiotic D. melanogaster were used to validate the hypothesis that AOS activated the Keap1-Nrf2 signaling pathway to achieve antioxidant effects by regulating intestinal microflora. The above results contribute to our understanding of the antioxidative mechanism of AOS and promote its application in the food industry.