  We study the effects of modified theories of gravity on the cosmic microwave
background (CMB) anisotropies power spectrum, and in particular on its large
scales, where the integrated Sachs-Wolfe (ISW) effect is important. Starting
with a general parametrisation, we then specialise to f(R) theories and
theories with Yukawa-type interactions between dark matter particles. In these
models, the evolution of the metric potentials is altered, and the contribution
to the ISW effect can differ significantly from that in the standard model of
cosmology. We proceed to compare these predictions with observational data for
the CMB and the ISW, performing a full Monte Carlo Markov chain (MCMC)
analysis. In the case of f(R) theories, the result is an upper limit on the
lengthscale associated to the extra scalar degree of freedom characterising
these theories. With the addition of data from the Hubble diagram of Type Ia
supernovae, we obtain an upper limit on the lengthscale of the theory of B_0 <
0.4, or correspondingly \lambda_1 < 1900 Mpc/h at 95% c.l. improving previous
CMB constraints. For Yukawa-type models we get a bound on the coupling 0.75 <
\beta_1 < 1.25 at the 95% c.l. We also discuss the implications of the assumed
priors on the estimation of modified gravity parameters, showing that a
marginally less conservative choice improves the f(R) constraints to \lambda_1
< 1400 Mpc/h, corresponding to B_0 < 0.2 at 95% c.l.
