The effect of the magnetic field gradient in the discharge channel of a Hall thruster on the ionization of the neutral gas and power deposition on the wall is studied through adopting the 2D-3V particle-in-cell (PIC) and Monte Carlo collisions (MCC) model. The research shows that by gradually increasing the magnetic field gradient while keeping the maximum magnetic intensity at the channel exit and the anode position unchanged, the ionization region moves towards the channel exit and then a second ionization region appears near the anode region. Meanwhile, power deposition on the walls decreases initially and then increases. To avoid power deposition on the walls produced by electrons and ions which are ionized in the second ionization region, the anode position is moved towards the channel exit as the magnetic field gradient is increased; when the anode position remains at the zero magnetic field position, power deposition on the walls decreases, which can effectively reduce the temperature and thermal load of the discharge channel.