We use supersymmetric localization to compute the sphere free energy of N=4 SYM with gauge group SU(N) deformed by a mass, i.e. the N=2* theory, to all orders in N for finite coupling g_YM and small mass. This quantity can be used to constrain the four-point function of stress tensor multiplet operators in N=4 SYM, which is holographically dual to scattering of gravitons on AdS^5xS^5, and is related to the Type IIB S-matrix in the flat space limit. In the large N and large 't Hooft coupling limit, where instantons are suppressed, we use this constraint as well as the flat space limit to fix this correlator to genus-two, i.e. two orders beyond the planar limit, to leading order in the 't Hooft coupling. In the large N and finite g_YM limit, where instantons contribute, we find that the N=2* free energy can be written in term of modular invariant Eisenstein series, which in the flat space limit match the analogous strong string coupling expression in the Type IIB S-matrix, which is the first check of AdS/CFT that is non-perturbative in the string coupling.