Here we describe 31 fossil teeth, deposited in the palaeontological collections of the Museo di Storia Naturale di Milano (MSNM), that come from the inland portion of the Mahajanga Basin, NW Madagascar, namely from the Sakahara Formation (classically known as Isalo IIIb subunit), which is dated to the Bathonian stage of the Middle Jurassic. Based on detailed morphological characters, the eight morphotypes recognized herein are tentatively referred to four sauropod taxa: Archaeodontosaurus descouensi, ‘Bothriospondylus madagascariensis’, Lapparentosaurus madagascariensis and an indeterminate specialized eusauropod, which may represent a new species and provides the first evidence of a Bathonian diplodocoid in Madagascar. The identification of the teeth is corroborated by comparative examination of morphometric data. We provide evidence that Titanosauriformes were present in the Bathonian, on the basis of seven specimens referable to this clade. We also discuss in detail some dental characters that support the existence of a clear niche partitioning between the abovementioned taxa that co‐existed in the Malagasy Middle Jurassic terrestrial ecosystem. We hypothesize, for the first time, a direct correlation between the pattern drawn on the tooth crown by the enamel wrinkles and the feeding ecology of sauropod dinosaurs. The enamel wrinkles probably played a structural function: coarse wrinkles were associated with a diet composed mainly of hard foodstuff, whereas fainter wrinkles, which appeared in more derived morphologies, were associated with a diet composed of softer foodstuff.