Results are reported for the B0s→μ+μ−s0→μ+μ− branching fraction and effective lifetime and from a search for the decay B0→μ+μ−0→μ+μ−. The analysis uses a data sample of proton-proton collisions accumulated by the CMS experiment in 2011, 2012, and 2016, with center-of-mass energies (integrated luminosities) of 7 TeV (5 fb−1−1), 8 TeV (20 fb−1−1), and 13 TeV (36 fb−1−1). The branching fractions are determined by measuring event yields relative to B+→+→J/ψψK++ decays (with J/ψ→μ+μ−ψ→μ+μ−), which results in the reduction of many of the systematic uncertainties. The decay B0s→μ+μ−s0→μ+μ− is observed with a significance of 5.6 standard deviations. The branching fraction is measured to be BB(B0s→μ+μ−s0→μ+μ−) = [2.9+0.7−0.6−0.6+0.7 (exp)±±0.2(frag)...