We derive from ambitwistor strings new formulae for two-loop scattering amplitudes in supergravity and super-Yang-Mills theory, with any number of particles. We start by constructing a formula for the type II ambitwistor string amplitudes on a genus-two Riemann surface, and then study the localisation of the moduli space integration on a degenerate limit, where the genus-two surface turns into a Riemann sphere with two nodes. This leads to scattering amplitudes in supergravity, expressed in the formalism of the two-loop scattering equations. For super-Yang-Mills theory, we import 'half' of the supergravity result, and determine the colour dependence by considering a current algebra on the nodal Riemann sphere, thereby completely specifying the two-loop analogue of the Parke-Taylor factor, including non-planar contributions. We also present in appendices explicit expressions for the Szegő kernels and the partition functions for even spin structures, up to the relevant orders in the degeneration parameters, which may be useful for related investigations in conventional superstring theory. arXiv:1805.05344v3 [hep-th] 17 Dec 2018 6 The amplitude on the bi-nodal Riemann sphere 51 6.1 The measure on the bi-nodal Riemann sphere 52 6.2 The scattering equations on the bi-nodal Riemann sphere 53 6.3 The chiral integrand on the bi-nodal Riemann sphere 55 6.4 Absence of unphysical poles 58 7 Super-Yang-Mills amplitudes 62 7.1 Parke-Taylor factor on the bi-nodal Riemann sphere 62 7.2 Colour trace decomposition 64 8 Discussion 65 -i -A Useful identities 67 A.1 Identities involving the chiral partition function 67 A.2 Useful identities for the PCO gauge slice 68 B Modular transformations and M g,n 68C The separating degeneration q 12 = 0 and uniqueness of f (q 12 )