Behind the standard version lie at least five Sumerian poems about Bilgames, the Sumerian form of the name, dating in written form to the early second millennium BCE and probably composed under the Third Dynasty of Ur, whose kings claimed him as a relative. These are independent short compositions, Gilgamesh and Huwawa, Gilgamesh and the Bull of Heaven, the Death of Bilgames, and others, not chapters of an epic. Some of their material is taken up in the Akkadian tradition and some, notably the Sumerian flood, is not.
An Old Babylonian version in Akkadian, from around the eighteenth century BCE, is the first to weld the episodes into a single connected poem with a governing theme. It survives only in fragments, including the well-known Pennsylvania and Yale tablets and a much-discussed passage in which an alewife advises Gilgamesh to enjoy ordinary life instead. The Old Babylonian poem differs from the later one in wording and in emphasis, and it is not simply an earlier draft of the same text.
The standard Babylonian version, the one usually translated, is a deliberate reworking from perhaps the thirteenth to eleventh centuries BCE. Mesopotamian catalogues attribute it to Sin-leqi-unninni, an exorcist-scholar, which is one of the very few named authorial attributions in cuneiform literature. What his editorial role amounted to is unknown: whether he composed the frame and the prologue, or standardised a text already in circulation, cannot be determined from the evidence, and the attribution itself is later than the reign in which he is supposed to have lived.