In 1959 Buchdahl \cite{Bu} obtained the inequality \(2M/R\leq 8/9\) under the assumptions that the energy density is non-increasing outwards and that the pressure is isotropic. Here \(M\) is the ADM mass and \(R\) the area radius of the boundary of the static body. The assumptions used to derive the Buchdahl inequality are very restrictive and e.g. neither of them hold in a simple soap bubble. In this work we remove both of these assumptions and consider \textit{any} static solution of the spherically symmetric Einstein equations for which the energy density \(\rho\geq 0,\) and the radial- and tangential pressures \(p\geq 0\) and \(p_T,\) satisfy \(p+2p_T\leq\Omega\rho, \Omega>0,\) and we show that \[\sup_{r>0}\frac{2m(r)}{r}\leq \frac{(1+2\Omega)^2-1}{(1+2\Omega)^2},\] where \(m\) is the quasi-local mass, so that in particular \(M=m(R).\) We also show that the inequality is sharp. Note that when \(\Omega=1\) the original bound by Buchdahl is recovered. The assumptions on the matter model are very general and in particular any model with \(p\geq 0\) which satisfies the dominant energy condition satisfies the hypotheses with \(\Omega=3.\)