In all mass cases needed for quark and gluon self-energies, the two-loop master diagram is expanded at large and small q2, in d dimensions, using identities derived from integration by parts. Expansions are given, in terms of hypergeometric series, for all gluon diagrams and for all but one of the quark diagrams; expansions of the latter are obtained from differential equations. Pade approximants to truncations of the expansions are shown to be of great utility. As an application, we obtain the two-loop photon self-energy, for all d, and achieve highly accelerated convergence of its expansions in powers of q2/m2 or m2/q2, for d=4.