The energy consumption and economic agglomeration degree in China have both grown rapidly in the past several years. It is expected that China will complete its urbanization process in the near future in which the energy demand may surge, so energy conservation will become extremely important. Thus, investigating how the degree of economic agglomeration influences energy efficiency is imperative. However, because of reverse causality, the endogeneity problem of the degree of economic agglomeration makes it difficult to identify the effect of economic agglomeration on energy efficiency. This paper adopts a novel stochastic frontier methodology to examine the relationship between them on the condition of addressing endogeneity well. Using the data from Chinese cities and adopting different instrumental variables, we find that the economic agglomeration degree has an inverted U-shaped impact on energy efficiency. When the economic agglomeration degree is below the critical point, its increase can improve the energy efficiency. After crossing the critical point, its increase will decrease the energy efficiency. Our findings are robust to concerns such as measurement of economic agglomeration degree, instrumental variable adequacy, and production function form in the model. We show that failure to address endogeneity will underestimate energy efficiency and obtain a biased conclusion about the relationship between the degree of economic agglomeration and energy efficiency. Our findings demonstrate that an agglomeration development strategy can be adopted to increase energy efficiency and conserve energy in current China. • The relationship between economic agglomeration degree and energy efficiency is investigated. • The endogeneity issue is addressed. • The energy conservation potential by optimizing economic agglomeration degree is estimated.