The fight between Naruto and Pain takes place over seven episodes, from 163 to 169. The majority of the fight between Naruto and Pain takes place in "Planetary Devastation," episode 166, which is episode 14 of season seven.