Formulating the alternating current optimal power flow (ACOPF) as a polynomial optimization problem makes it possible to solve large instances in practice and to guarantee asymptotic convergence in theory. We formulate the ACOPF as a degree-two polynomial program and study two approaches to solving it via convexifications. In the first approach, we tighten the first-order relaxation of the nonconvex quadratic program by adding valid inequalities. In the second approach, we exploit the structure of the polynomial program by using a sparse variant of Lasserre's hierarchy. This allows us to solve instances of up to 39 buses to global optimality and to provide strong bounds for the Polish network within an hour.