Objective To investigate the AIDS knowledge and sexual behavior of middle school students in the key areas of HIV/AIDS epidemic in Liangshan, Sichuan Province in 2015 and 2020, so as to understand the epidemic trend and acquire possible references for future prevention. Methods A survey on AIDS knowledge and sexual behavior of middle school students was conducted in 2015 and 2020 in the key areas of HIV/AIDS epidemic in Liangshan, Sichuan Province, respectively. The prevalences of HIV/AIDS knowledge and sexual behavior were analyzed. Results The rate of AIDS education was increasing, which was 75.4% in 2015 and 89.3% in 2020, respectively. However, the awareness rate of AIDS remained low, which was 44.4% in 2015 and 53.3% in 2020, respectively. The reported rate of sexual behavior decreased, which was 12.8% in 2015 and 1.6% in 2020, respectively. The condom usage rates were still low, with 47.4% and 55.8%, respectively in 2015 and 2020. Conclusions The AIDS publicity and education work in Liangshan is effective, and the awareness rate of AIDS, the rate of sexual behavior and the usage rate of condom are improving well. However, the slow increase in the awareness rate of AIDS and the usage rate of condom require further in-depth analysis aiming at the specification of this area so that effective scientific measures can be carried out to prevent the HIV/AIDS diffusion.