We consider the transverse-momentum ($p_T$) distribution of $ZZ$ and $W^+W^-$ boson pairs produced in hadron collisions. At small $p_T$, the logarithmically enhanced contributions due to multiple soft-gluon emission are resummed to all orders in QCD perturbation theory. At intermediate and large values of $p_T$, we consistently combine resummation with the known fixed-order results. We exploit the most advanced perturbative information that is available at present: next-to-next-to-leading logarithmic resummation combined with the next-to-next-to-leading fixed-order calculation. After integration over $p_T$, we recover the known next-to-next-to-leading order result for the inclusive cross section. We present numerical results at the LHC, together with an estimate of the corresponding uncertainties. We also study the rapidity dependence of the $p_T$ spectrum and we consider $p_T$ efficiencies at different orders of resummed and fixed-order perturbation theory.