Conjugative plasmids play a vital role in bacterial adaptation through horizontal gene transfer. Explaining how plasmids persist in host populations however is difficult, given the high costs often associated with plasmid carriage. Compensatory evolution to ameliorate this cost can rescue plasmids from extinction. In a recently published study we showed that compensatory evolution repeatedly targeted the same bacterial regulatory system, GacA/GacS, in populations of plasmid-carrying bacteria evolving across a range of selective environments. Mutations in these genes arose rapidly and completely eliminated the cost of plasmid carriage. Here we extend our analysis using an individual based model to explore the dynamics of compensatory evolution in this system. We show that mutations which ameliorate the cost of plasmid carriage can prevent both the loss of plasmids from the population and the fixation of accessory traits on the bacterial chromosome. We discuss how dependent the outcome of compensatory evolution is on the strength and availability of such mutations and the rate at which beneficial accessory traits integrate on the host chromosome.