We use the projected correlation function w _ { p } ( r _ { p } ) of a volume-limited subsample of the Sloan Digital Sky Survey ( SDSS ) main galaxy redshift catalogue to measure the halo occupation distribution ( HOD ) of the galaxies of the sample . Simultaneously , we allow the cosmology to vary within cosmological constraints imposed by cosmic microwave background experiments in a \Lambda CDM model . We find that combining w _ { p } ( r _ { p } ) for this sample alone with the observations by WMAP , ACBAR , CBI and VSA can provide one of the most precise techniques available to measure cosmological parameters . For a minimal flat six-parameter \Lambda CDM model with an HOD with three free parameters , we find \Omega _ { m } = 0.278 ^ { +0.027 } _ { -0.027 } , \sigma _ { 8 } = 0.812 ^ { +0.028 } _ { -0.027 } , and H _ { 0 } = 69.8 ^ { +2.6 } _ { -2.6 } km s ^ { -1 } Mpc ^ { -1 } ; these errors are significantly smaller than from CMB alone and similar to those obtained by combining CMB with the large-scale galaxy power spectrum assuming scale-independent bias . The corresponding HOD parameters describing the minimum halo mass and the normalization and cut-off of the satellite mean occupation are M _ { min } = ( 3.03 ^ { +0.36 } _ { -0.36 } ) \times 10 ^ { 12 } h ^ { -1 } M _ { \odot } , M _ { 1 } = ( 4.58 ^ { +0.60 } _ { -0.60 } ) \times 10 ^ { 13 } h ^ { -1 } M _ { \odot } , and \kappa = 4.44 ^ { +0.51 } _ { -0.69 } . These HOD parameters thus have small fractional uncertainty when cosmological parameters are allowed to vary within the range permitted by the data . When more parameters are added to the HOD model , the error bars on the HOD parameters increase because of degeneracies , but the error bars on the cosmological parameters do not increase greatly . Similar modeling for other galaxy samples could reduce the statistical errors on these results , while more thorough investigations of the cosmology dependence of nonlinear halo bias and halo mass functions are needed to eliminate remaining systematic uncertainties , which may be comparable to statistical uncertainties .