Starting from Earth's orbit, tilt the sail to push the craft outward or inward. Blue: sail craft. Grey dashed: the same craft with the sail furled (pure gravity).
The science
Sunlight carries momentum. A flat sail of area A at distance r receives radiation pressure P = L / (4 pi r^2 c), about 9.1 micro-newtons per square metre for a perfect mirror at 1 AU. For a sail tilted by cone angle alpha between its normal and the Sun line the force is normal to the sail with magnitude F = (1+rho)/2 * P A cos^2(alpha) (rho = reflectivity; this ignores the small tangential force of an imperfect sail).
Both gravity and light fall off as 1/r^2, so their ratio is a constant, the lightness number beta = (1+rho)/2 * sigma* / sigma with sigma* = 1.53 g/m^2 (sigma is the total craft mass per sail area, the sail loading). The craft obeys a = -mu r/|r|^3 + beta mu cos^2(alpha) n / r^2 with mu = 4 pi^2 AU^3/yr^2, integrated here with fourth-order Runge-Kutta.
To raise the orbit fastest, the force component along the direction of motion, proportional to cos^2(alpha) sin(alpha), must be largest. Setting its derivative to zero gives tan(alpha) = 1/sqrt(2), alpha = 35.26 deg. Tilting the other way (negative cone angle) removes orbital energy and spirals inward toward Venus or Mercury.
Simplifications: flat ideal sail, point-mass Sun, planets on circular coplanar orbits, no sail degradation, no launch phase, and the sail normal swings instantly. Real missions (IKAROS, LightSail 2) have far smaller beta than the top of the sliders.