The impulse radio-ultra wideband (IR-UWB) ranging algorithm based on energy detection is widely applied, improving ranging accuracy turns out to be a key point that draws many researchers' attentions. A new two-step-integral time of arrival (TOA) estimation algorithm based on threshold comparison (TC) was proposed, and the corresponding threshold-setting algorithm was also put forward. The ranging accuracy of the TC algorithm for long integration period is lower than that, for short, the two-step-integral TOA estimation algorithm is built up by one more short integration period detection based on long integration period; according to the functional relation between the optimal normalized threshold and advanced maximum energy sample to mean ratio-TC (AMMR-TC) is proposed and the optimal normalized threshold is set. Due to the performance of AMMR-TC is worse than maximum to minimum energy sample ratio-TC (MMR-TC) a little in short integration period, a novel AMMR-MEAN-TC algorithm is put forward in the paper by combining the two algorithms above. Simulations indicate that the ranging accuracy had been improved. © 2015, Beijing University of Posts and Telecommunications. All right reserved.