  We obtain the next-to-next-to-leading order corrections to
transverse-momentum spectra of W, Z and Higgs bosons near the partonic
threshold. In the threshold limit, the electroweak boson recoils against a
low-mass jet and all radiation is either soft, or collinear to the jet or the
beam directions. We extract the virtual corrections from known results for the
relevant two-loop four-point amplitudes and combine them with the soft and
collinear two-loop functions as defined in Soft-Collinear Effective Theory. We
have implemented these results in a public code PeTeR and present numerical
results for the threshold resummed cross section of W and Z bosons at
next-to-next-to-next-to-leading logarithmic accuracy, matched to
next-to-leading fixed-order perturbation theory. The two-loop corrections lead
to a moderate increase in the cross section and reduce the scale uncertainty by
about a factor of two. The corrections are significantly larger for Higgs
production.
