  We present the calculation of the two-loop soft function for the transverse
momentum distribution of the leading jet produced in association with any
colour-singlet system (e.g.~a Higgs or a $Z$ boson). This constitutes a central
ingredient for the resummation of the above distribution as well as the
jet-vetoed cross section at the next-to-next-to-next-to-leading logarithmic
order, both of which play an important role in the precision physics programme
at the Large Hadron Collider. The calculation is performed in soft-collinear
effective theory with an appropriate regularisation of the rapidity divergences
that occur in the phase-space integrals. We obtain analytic results by
employing an exponential regulator and by taking a Laurent expansion in the jet
radius $R$. All expressions are presented as ancillary files with this article.
