Although homologous recombination is considered an accurate form of DNA repair, genetics suggest that the Escherichia coli translesion DNA polymerase IV (Pol IV, also known as DinB) promotes error-prone recombination during stress, which allows cells to overcome adverse conditions. However, how Pol IV functions and is regulated during recombination under stress is unknown. We show that Pol IV is highly proficient in error-prone recombination and is preferentially recruited to displacement loops (D loops) at stress-induced concentrations in vitro. We also found that high-fidelity Pol II switches to exonuclease mode at D loops, which is stimulated by topological stress and reduced deoxyribonucleotide pool concentration during stationary phase. The exonuclease activity of Pol II enables it to compete with Pol IV, which probably suppresses error-prone recombination. These findings indicate that preferential D-loop extension by Pol IV facilitates error-prone recombination and explain how Pol II reduces such errors in vivo.