A measurement of the branching fraction of the decay Bs0→KS0KS0 is performed using proton-proton collision data corresponding to an integrated luminosity of 5 fb−1 collected by the LHCb experiment between 2011 and 2016. The branching fraction is determined to be BR(Bs0→KS0KS0) = [8.3 ± 1.6 (stat) ± 0.9 (syst) ± 0.8 (norm) ± 0.3 (fs/fd)] ×10−6 , where the first uncertainty is statistical, the second is systematic, and the third and fourth are due to uncertainties on the branching fraction of the normalization mode B0→ϕKS0 and the ratio of hadronization fractions fs/fd. This is the most precise measurement of this branching fraction to date. Furthermore, a measurement of the branching fraction of the decay B0→KS0KS0 is performed relative to that of the Bs0→KS0KS0 channel, and is found to be BR(Bs0→KS0KS0)BR(B0→KS0KS0) = [7.5 ± 3.1 (stat) ± 0.5 (syst) ± 0.3 (fs/fd)] ×10−2.