Chemical insecticides have been heavily employed as the most effective measure for control of agricultural and medical pests, but evolution of resistance by pests threatens the sustainability of this approach. Resistance-conferring mutations sometimes impose fitness costs, which may drive subsequent evolution of compensatory modifier mutations alleviating the costs of resistance. However, how modifier mutations evolve and function to overcome the fitness cost of resistance still remains unknown. Here we show that overexpression of P450s not only confers imidacloprid resistance in the brown planthopper, Nilaparvata lugens, the most voracious pest of rice, but also leads to elevated production of reactive oxygen species (ROS) through metabolism of imidacloprid and host plant compounds. The inevitable production of ROS incurs a fitness cost to the pest, which drives the increase or fixation of the compensatory modifier allele T65549 within the promoter region of N. lugens peroxiredoxin (NlPrx) in the pest populations. T65549 allele in turn upregulates the expression of NlPrx and thus increases resistant individuals' ability to clear the cost-incurring ROS of any source. The frequent involvement of P450s in insecticide resistance and their capacity to produce ROS while metabolizing their substrates suggest that peroxiredoxin or other ROS-scavenging genes may be among the common modifier genes for alleviating the fitness cost of insecticide resistance.