A search for the Higgs boson decaying to two oppositely charged muons is presented using data recorded by the CMS experiment at the CERN LHC in 2016 at a center-of-mass energy s=13 TeV, corresponding to an integrated luminosity of 35.9 fb-1. Data are found to be compatible with the predicted background. For a Higgs boson with a mass of 125.09 GeV, the 95% confidence level observed (background-only expected) upper limit on the production cross section times the branching fraction to a pair of muons is found to be 3.0 (2.5) times the standard model expectation. In combination with data recorded at center-of-mass energies s=7 and 8 TeV, the background-only expected upper limit improves to 2.2 times the standard model value with a standard model expected significance of 1.0 standard deviation. The corresponding observed upper limit is 2.9 with an observed significance of 0.9 standard deviation. This corresponds to an observed upper limit on the standard model Higgs boson branching fraction to muons of 6.4×10-4 and to an observed signal strength of 1.0±1.0(stat)±0.1(syst).