A general model for the early recognition and colocalization of homologous DNA sequences is proposed. We show, on thermodynamic grounds, how the distance between two homologous DNA sequences is spontaneously regulated by the concentration and affinity of diffusible mediators binding them, which act as a switch between two phases corresponding to independence or colocalization of pairing regions