We present a search for pair production of doubly charged Higgs bosons in the processes q¯q→H++H−− decaying through H±±→τ±τ±,μ±τ±,μ±μ±. The search is performed in p¯p collisions at a center-of-mass energy of √s=1.96 TeV using an integrated luminosity of up to 7.0 fb−1 collected by the D0 experiment at the Fermilab Tevatron Collider. The results are used to set 95% C.L. limits on the pair production cross section of doubly charged Higgs bosons and on their mass for different H±± branching fractions. Models predicting different H±± decays are investigated. Assuming B(H±±→τ±τ±)=1 yields an observed (expected) lower limit on the mass of a left-handed H±±L boson of 128 (116) GeV and assuming B(H±±→μ±τ±)=1 the corresponding limits are 144 (149) GeV. In a model with B(H±±→τ±τ±)=B(H±±→μ±τ±)=B(H±±→μ±μ±)=1/3, we obtain M(H±±L)>130 (138) GeV.