At present, with the continuous development of Chinese agricultural industrialization and rural urbanization, the traditional household biogas has been gradually replaced by more efficient medium and large-scale biogas system. Medium and large-scale biogas system can provide biogas as stable and clean cooking energy for rural residents depending on centralized utilization of agricultural organic wastes. It has a good impact on the indoor and outdoor environment in rural areas, and is in line with the requirements of the transformation of China’s rural energy structure. Further, it is a new trend for the development of rural energy in China. In this paper, the cost-benefit analysis method is used to quantify the economic and environmental benefits of these medium and large-scale biogas systems investigated by the author. Then, according to the internal rate of return (IRR) of each original system, these original systems is divided into three levels: the first level system-the better economic benefit (the IRR is greater than the discount rate 0.08), the second level system-the general economic benefit (the IRR is less than the discount rate 0.08, but more than 0), the tertiary level system-poor economic benefits (the IRR is less than 0). After considering the scale, benefits, conditions and the necessity of optimization of different levels of systems, the optimization measures are formulated to meet the needs of reality in different levels. The results show that: 1) The environmental benefit of the original system before optimization is generally good. Among them, carbon emission reduction is the most significant. In order of project scale from large to small (Baishuzhuang community, Nanan community, Tianma community, Shangzhai village, Shiyang village, Lianwang village, Yuepu village, Yezhao village, Xiaoguoyuan village), carbon emission reduction can reach 269 427.94, 230 788.18, 237 299.61, 231 344.26, 103 604.36, 81 050.29, 79 047.68, 90 434.88, 36 584.20 kg per year, respectively. 2) There are great differences in economic benefits before optimization, and the internal rates of return are as follows:-7%, -3%, -3%, 7%, 6%, 5%, 7%, 14%, 12%, which shows that the larger the scale is, the more uneconomical it is. 3) With the discount rate of 0.08 and the 0 as the stratified points, the original system is divided into three levels to optimize according to the internal rates of return of each system. 4) In the first-level system, the economic benefits of the two projects (Yezhao village and Xiaoguoyuan village) are already good. After optimization, the economic benefits decreased by 1.50% and 1.51%, respectively, but the carbon emission reduction increased by 112.88% and 134.43%, respectively. The overall optimization results are remarkable. 5) In the four projects (Shangzhai village, Shiyang village, Lianwang village, Yuepu village) of the second-level system, because the internal rate of return is more than 8%, the economic benefits are upgraded from general to good. In addition, the environmental benefit increased by 88.16%, 100.02%, 103.22%, 109.09%, respectively. The optimization effect is also remarkable. 6) In the third-level system (Baishuzhuang community, Nanan community, Tianma community), the internal rate of return of most projects becomes positive after optimization, and the economic benefits are upgraded from no to general, while the environmental benefit increases by 116.36%, 123.92% and 101.19%, respectively. The overall optimization results are good. 7) The main measure of optimization is to cut down the operating cost, but the reality is more complicated, so the local conditions should be adapted to local conditions, and the optimization measures should be chosen flexibly. 8) Those large-scale systems need to actively refer to the national biogas project construction plan and strictly control the cost when building it. [ABSTRACT FROM AUTHOR]