The middle–upper Miocene (Serravallian-Tortonian) Gatun Formation of Panama is one of the most diverse marine fossil assemblages in the Caribbean, and has been widely used as a baseline in studies investigating the effects of the late Neogene closure of the Central American Seaway. Despite being the focus of exhaustive paleoecological sampling studies, previous studies have not revealed the fine-scale spatial and temporal variation in the composition of the Gatun fauna. High-resoluton faunal inventories were conducted from over 600 stratigraphic horizons in the Gatun Formation, capturing more than 200 species, which represent mostly widespread or common, and typically macroscopic taxa. Cluster and detrended correspondence analyses (DCA) reveal a stratigraphic pattern of variation in the faunal composition of individual horizons as well as differences between sampling sites. Stratigraphic curves of DCA axis scores indicate relative shifts in water depth and sedimentation through the stratigraphy and among localities. Overall the Gatun reveals both coarse- and fine-scale temporal variations in paleobathymetry, reflecting long-term shifts in basin subsidence and accommodation space that is potentially overprinted by fifth- or sixth-order glacio-eustatic cycles. The formation accumulated during an overall phase of increasing accommodation space, with major intervals of transgression (lower Gatun), regression (middle Gatun), and further transgression to mid-shelf depths (upper Gatun). Shallowing through the middle part of the Gatun is largely the result of an increase in supply of pyroclastic and volcaniclastic sediments from the adjacent volcanic arc. These findings have implications for understanding the tectonic evolution of the Canal Basin.