Carbon dioxide (CO2 ) exposure is a common method of anesthesia in studies of Drosophila melanogaster. A number of negative side effects of CO2 anesthesia have been reported. It is not clear whether the length of CO2 anesthesia time affects Drosophila survival in aging research. Here, we examined the potential effect of the CO2 anesthesia time length of 10-150 min. We found that long CO2 exposure could lead to Drosophila death, more significant in males. The longer the anesthesia time is, the longer it takes for flies to wake up. Long-time CO2 anesthesia can reduce the lifespan. Our stress tests showed that long-time CO2 anesthesia can increase the average survival time in both males and females under starvation conditions, but can only increase female lifespan under H2 O2 oxidative stress. Long-time CO2 anesthesia also significantly affects physiological traits, with spontaneous activity increased in females but decreased in males, and reduced female fecundity. Our study suggests that limiting the CO2 anesthesia time and giving enough recovery time before performing physiological tests are important in Drosophila aging research.