In view of the importance of inert-atmosphere sludge pyrolysis for effective waste recycling and carbon emission reduction, this study probed the effects of temperature (300-700 oC) and atmosphere (100% N2, 10 CO2/90% N2, or 100% CO2) on the properties of biochar and gases obtained by sludge pyrolysis in a horizontal tube furnace. The emissions of NO, SO2, H2S, and CO increased with increasing temperature, as the inhibitory effect of CO2 on the formation of these gases (observed at <500 oC) concomitantly weakened and was superseded by the reaction of CO2 with carbon at higher temperature to afford gaseous products. The specific surface area (SBET) and pore volume of the biochar produced in the presence of CO2 increased with increasing temperature up to 500 oC, while at higher temperatures the inhibitory effect of CO2 on pore structure development resulted in a decreased SBET and an increased macropore content. These results show that pyrolysis is an effective treatment method for sludge; it can remove 48% N and 50% S in sludge and mitigate the emission of polluting gases. When CO2 participates in the pyrolysis reaction, the SBET of biochar increases significantly. In general, sludge biochar has the potential to be applied as fuel and as an adsorbent.