A search for supersymmetry involving the pair production of gluinos decaying via third-generation squarks into the lightest neutralino (χ˜10) is reported. It uses LHC proton-proton collision data at a centre-of-mass energy s=13 TeV with an integrated luminosity of 36.1 fb−1 collected with the ATLAS detector in 2015 and 2016. The search is performed in events containing large missing transverse momentum and several energetic jets, at least three of which must be identified as originating from b-quarks. To increase the sensitivity, the sample is divided into subsamples based on the presence or absence of electrons or muons. No excess is found above the predicted background. For χ˜10 masses below approximately 300 GeV, gluino masses of less than 1.97 (1.92) TeV are excluded at 95% confidence level in simplified models involving the pair production of gluinos that decay via top (bottom) squarks. An interpretation of the limits in terms of the branching ratios of the gluinos into third-generation squarks is also provided. These results improve upon the exclusion limits obtained with the 3.2 fb−1 of data collected in 2015.[Figure not available: see fulltext.].