The hazards caused by gas explosion are mainly due to high temperatures and shock waves. It is of great practical significance to explore a device that can restrain these two hazards at the same time. Through the establishment of the gas explosion calculation model, a numerical analysis of the flame propagation in the three types of pipelines, including the empty pipe, the single metal foam pipe, and the high-temperature heat pipe metal foam composite structure, was carried out. The numerical results are compared with the relevant experimental results. The accuracy, rationality, and accuracy of the calculation model is verified. The research results show that that the gas explosion flame propagation develops fastest and accelerates in the empty pipe, followed by a single metal foam pipe. The gas explosion flame in the pipe with the high-temperature heat pipe metal foam composite structure develops the slowest. The composite structure composed of the high-temperature heat pipe and metal foam is an obvious choice to attenuate the temperature and overpressure of gas explosion. The high-temperature heat pipe can rapidly transmit heat in the form of phase change, and metal foam can effectively reduce the explosion pressure wave. The composite structure with the high-temperature heat pipe, and metal foam, destroys the coupling between flame and pressure wave, which acts as a barrier to explosion. It can effectively reduce the energy of flammable and explosive gas in the rear part of the pipeline and restrain the occurrence of the two explosions. The research results provide a scientific basis for the technical application of new, effective anti-explosion devices in coal mines.