We compute the Schrodinger functional (SF) for the case of pure SU(3) gauge theory at two-loop order in lattice perturbation theory. This allows us to extract the three-loop p-function in the SF scheme. These results are required to compute the running coupling, the Lambda-parameter and quark masses by finite size techniques with negligible systematic errors, In addition, we can now implement two-loop O(a) improvement in simulations and extend and study series in alternative ("tadpole-improved'') bare couplings. (C) 1999 Elsevier Science B.V.