After the analysis of gas flow, energy consumption is mainly in the process of heating gas pipeline and natural gas throttle. For this problem, this paper, heat transfer, thermodynamics, computational fluid dynamics are used, the pipeline throttling, convection of natural gas in the pipe and the heat transfer between the gas, wall panels, heating cable, insulation, soil and the atmosphere are all considered, thermal analysis model between the wellhead and the gas gathering station is established, the electric heating power on the gas pipeline is optimized, the optimal electric heating power can be calculated when the temperature of wellhead and gas gathering station is expected to reach are known. The effect of tube diameter, gas volume, surface temperature on the heating power is analyzed.