The 29-year-old shot a total of 216.7 in the eight-man final to finish third on the podium.
The Asian Games and World Championships silver-medallist was languishing at the seventh position after the end of the first competition series that included an 8.8.
But he clawed his way back with two 10.6 and a 10 in the second competition series. At the end of that series, Rai was placed sixth with a total of 98.7.
He managed to maintain the status quo even as the final entered the elimination stage at the Dr Karni Singh Shooting Range. He shot two 10s in the following shots to continue his gradual ascent.
The Army man roared back to contention with a couple of 10.6 and ensured a bronze with a 9.9, finishing ahead of China’s Zhanyi Xu (197.9).
With a lead of 0.1 point over Vietnam’s Xuang Vinh Hoang, Rai was in the hunt for a silver but an 8.6 meant he had to be content with the bronze.
The gold went to Japan’s Tomoyuki Matsuda with a world record total of 240.1 points, while Vietnam’s Xuan Vinh Hoang claimed silver with 236.6 points.
The other Indian shooters in the fray in the air pistol event — Omkar Singh and Amanpreet Singh — failed to cross the qualification stage.
PTI