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 13 TeV, corresponding to an integrated luminosity of 35.9 fb. 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 (expected) upper limit on the production cross section times branching fraction to a pair of muons is found to be 2.95 (2.45) times the standard model expectation. In combination with data recorded at center-of-mass energies 7 and 8 TeV, the observed (expected) upper limit improves to 2.92 (2.16) times the standard model value. This corresponds to an upper limit on the standard model Higgs boson branching fraction to muons of .