Measurements of the muon charge asymmetry in inclusive pp→W+X production at s=7 TeV are presented. The data sample corresponds to an integrated luminosity of 4.7 fb−1 recorded with the CMS detector at the LHC. With a sample of more than 20 million W→μν events, the statistical precision is greatly improved in comparison to previous measurements. These new results provide additional constraints on the parton distribution functions of the proton in the range of the Bjorken scaling variable x from 10-3 to 10-1. These measurements and the recent CMS measurement of associated W+charm production are used together with the cross sections for inclusive deep inelastic e±p scattering at HERA in a next-to-leading-order QCD analysis. The determination of the valence quark distributions is improved, and the strange-quark distribution is probed directly through the leading-order process g+s→W+c in proton-proton collisions at the LHC.