  Branching fraction and effective lifetime measurements of the rare decay
$B^0_s\to\mu^+\mu^-$ and searches for the decays $B^0\to\mu^+\mu^-$ and
$B^0_s\to\mu^+\mu^-\gamma$ are reported using proton-proton collision data
collected with the LHCb detector at centre-of-mass energies of $7$ TeV, $8$ TeV
and $13$ TeV, corresponding to a luminosity of $9$ fb$^{-1}$. The branching
fraction
${\mathcal{B}}(B^0_s\to\mu^+\mu^-)=\left(3.09^{+0.46+0.15}_{-0.43-0.11}\right)\times
10^{-9}$ and the effective lifetime $\tau(B^0_s\to\mu^+\mu^-)=(2.07\pm 0.29\pm
0.03)$ are measured, where the first uncertainty is statistical and the second
systematic. No significant signal for $B^0\to\mu^+\mu^-$ and
$B^0_s\to\mu^+\mu^-\gamma$ decays is found and upper limits
$\mathcal{B}(B^0\to\mu^+\mu^-)<2.6\times 10^{-10}$ and
$\mathcal{B}(B^0_s\to\mu^+\mu^-\gamma)<2.0\times 10^{-9}$ at the 95% CL are
determined, where the latter is limited to the range $m_{\mu\mu} > 4.9$
GeV$/c^2$. The results are in agreement with the Standard Model expectations.
