We present a detailed and homogeneous analysis of the ROSAT PSPC surface brightness profiles of 36 clusters of galaxies with high X-ray luminosity (L-X greater than or similar to 10(45) erg s(-1)) and redshifts between 0.05 and 0.44. Using recent ASCA estimates of the temperature of the gas for most of the clusters in the sample, we apply both the deprojection technique and model fitting to the surface brightness profiles to constrain the gas and dark matter distributions under the assumption that the gas is both isothermal and hydrostatic. Applying robust estimators, we find that the gas fraction within r(500) of the clusters in our sample has a distribution centred on f(gas)(r(500)) = 0.168 h(50)(-1.5). The gas fraction ranges from. 0.101 to 0.245 at the 95 per cent confidence level. The values of f(gas) show highly significant variations between individual clusters, which may be explained if the dark matter has a significant baryonic component. Within a cluster, the average radial dependence of the gas mass fraction increases outward as r(s), with s similar to 0.20. Combining these results with those of primordial nucleosynthesis calculations and the current estimate of H-0, the above central location implies Ohm(0,m) less than or similar to 0.56 at the 95 per cent confidence level. This upper limit decreases to 0.34 if we take the highest significant estimates for f(gas). A significant decrease in cluster gas fraction with redshift from the local value, f(gas,0), of 0.21, found assuming Ohm(0,m) = 1, is also reduced if Ohm(0,m) is low.