In recent years, polyethylene (PE) pipes have been widely utilized for urban natural gas transmission. However, as the use of high-density polyethylene (HDPE) pipes increases, their service life and long-term performance assessment have become one of the most significant issues to be addressed. There has been a ton of studies on PE pipe life prediction techniques both domestically and internationally, but very little has been carried out on PE pipe life prediction in actual gas working environments with varying acid and alkaline levels. This experiment accelerates the aging of PE pipes using acid and alkaline corrosion immersion experiments to determine the lifespan of PE pipes. This study aims to investigate the performance changes of HDPE under strong, weak, and neutral corrosion conditions using corrosion solutions with PH values of 1, 5, and 8, to propose the impact of corrosion caused by various acids and alkalies on the HDPE aging life for natural gas, and to develop a mathematical model between the aging life of polyethylene and the PH values of acid and alkali corrosion solutions. The studies involved soaking and corroding HDPE pipes with various acidity and alkalinity chemicals to speed up the aging process, and then the tensile test was used to determine the mechanical characteristics of the aged PE pipes. Based on our findings, the empirical equation between acidity and service life of PE pipes is obtained by the mathematical fitting method, and a life prediction model of buried city gas HDPE pipes is proposed. The actual life of the aged pipes is determined by the relationship between strain-hardening (SH) modulus and aging time. The findings demonstrate that the service life of PE pipes changes with different levels of acidity and alkalinity: 1.872 days, 1060.507 days, and 1128.58 days following corrosive solution-accelerated aging with solution acidities of PH1, PH5, and PH8, respectively. The life prediction method applies to various plastic pipes in comparable environments as well as HDPE city gas pipes that are subject to acid and alkali corrosion forces.