The Early to Middle Miocene fossil locality Sandelzhausen has yielded 48 species of ectothermic vertebrates and thus represents one of the most diverse ectotherm faunas of Miocene age. Thirty-five taxa of fishes, amphibians and reptiles, including three new species: Pelobates fahlbuschi nov. sp. (Pelobatidae, the most abundant vertebrate), Tropidophorus bavaricus nov. sp. (Lygosominae) and Bavaricordylus molassicus nov. sp. (Cordylidae), are described. Three additional species are new, but are not named yet: Ranidae indet. nov. gen. et sp., Anguidae gen. indet. sp. nov. and Palaeoblanus sp. nov. (Amphisbaenidae). In order to reconstruct the palaeoenvironment and past hydrologic conditions, a new methodology (the tooth replacement method, TRM) is introduced, which allows for the detection of autochthonous components within freshwater fish taphocoenose. TRM is tested on 45 localities from the Upper Freshwater Molasse and gives reasonable results in agreement with other analytical approaches. It is therefore viewed as a reliable method to distinguish perennial from seasonal water conditions at the Sandelzhausen locality. Using the TRM it was demonstrated that the palaeohydrology of Sandelzhausen is characterized by a change from temporary water to permanent water conditions. During the period of temporary water conditions (units B to D1, lower part) the ecosystem was driven by seasonal inundations, and the remaining riparian pools have yielded no autochthonous fish population, but acted as spawning places for amphibians (amphibian pool). A mostly open habitat in the close vicinity, with sandy and non-groundwater-affected soils during the dry season, is suggested based on the absolute dominance of the spadefoot Pelobates fahlbuschi nov. sp. This ecosystem changed up-section (late part of unit D1 and during D2 and E) due to the establishment of permanent water conditions of riparian pond type, preserving an autochthonous Palaeocarassius/Channa fish population (fish pond). The reconstructed precipitation values suggest that the observed change in hydrologic conditions was probably driven by climate. The lower part of the section gives semi-arid/subhumid values, with 571 mm mean annual precipitation (MAP), whereas the upper part yields sub-humid/humid values of 847 mm MAP. The increase in precipitation by about 280 mm was perhaps caused by a less seasonal precipitation regime with concomitant higher regional groundwater tables during units D2 and E. Based on the occurrence of several thermophilous reptile species, and in agreement with palaeobotanical and oxygen isotope data, the climate of Sandelzhausen is interpreted as subtropical with mean annual temperatures from 18°C to 20.8°C, mean cold month temperatures from 12.6°C to 13.3°C and mean warm month temperatures from 25.1°C to 28.1°C.