Petrographic and stable isotope investigations of Oligocene‐Miocene carbonates in the Asmari Formation from the Gachsaran oilfield and surrounding area in SW Iran indicate that the carbonates have been subjected to extensive diagenesis including calcite cementation and dolomitization. Diagenetic modification occurred in different diagenetic realms ranging from marine, meteoric and finally burial.Asmari carbonates were in general deposited in a ramp setting and are represented by intertidal to subtidal deposits together with lagoonal, shoal and low‐energy deposits formed below normal wave base. Lithofacies include bioclastic grainstones, ooidal and bioclastic, foraminiferal and intraclastic packstones, and mudstones. Multiple episodes of calcite cementation, dolomitization and fracturing have affected these rocks to varying degrees and control porosity. Four types of dolomites have been identified: microcrystalline matrix replacement dolomite (D1); fine to medium crystalline matrix replacement dolomite (D2); coarse crystalline saddle‐like dolomite cement (D3); and coarse crystalline zoned dolomite cement (D4).Microcrystalline dolomites (D1) (6–12 μm) replacing micrite, allochems and calcite cements in the mud‐supported facies prior to early compaction show δ18O and δ13C values of −4.01 to +1.02‰ VPDB and −0.30 to +4.08‰ VPDB, respectively. These values are slightly depleted with respect to postulated Oligocene‐Miocene marine carbonate values, suggesting their precipitation from seawater, partly altered by later fluids. The association of this type of dolomite with primary anhydrite in intertidal facies supports dolomitization by evaporative brines.Fine to medium crystalline matrix dolomites (D2) (20–60μm) occur mostly in grainstone facies and have relatively high porosities. These dolomites formed during early burial and could be considered as recrystallized forms of D1 dolomite. Their isotopic values overlap those of D1 dolomites, implying precipitation from similar early fluids, possibly altered by meteoric fluids.Coarse crystalline saddle‐like dolomites (D3) (200–300 μm) partially or completely occlude fractures and vugs. The vugs developed through the dissolution of carbonate components and rarely matrix carbonates, while fractures developed during Zagros folding in late Oligocene to early Miocene times.A final diagenetic episode is represented by the precipitation of coarse crystalline planar e‐s zoned dolomite (D4) (80–250 μm) that occurs in fractures and vugs and also replaces earlier dolomite and post‐dates stylolitization. Fluids responsible for the formation of D3 and D4 dolomites are affected by brine enrichment and increasing temperatures due to increasing burial.Reservoir porosity is dominated by microcrystalline pore spaces in muddy, dolomitized matrix and mouldic and vuggy porosity in grainstone. Porosity was significantly enhanced by the formation of multiple fracture systems.