The Epic of Gilgamesh has several moral themes, but the main theme is that love is a motivating force. Other moral themes in this epic are the inevitability of death and the danger of dealing with the gods.
The love within the friendship of Enkidu and Gilgamesh inspires both of them to be better men in different ways. Gilgamesh was able to pull Enkidu out of his self-centered ways and inspire Enkidu into nobility. In turn, Enkidu checks the restlessness of Gilgamesh and motivates Gilgamesh to stop his bullying and tyranny, allowing him to become a better hero and king. Their connection allows Gilgamesh to get in touch with his people's needs.
The lack of a romantic female interest in this epic does not mean erotic love plays no role. Enkidu's education begins with his sexual initiation by a temple harlot. This is what begins the two hero's troubles, as it coincides with their disapproval of Ishtar, the goddess of love. It is only when Gilgamesh understands that his place is on earth that Ishtar returns to her place of honor.
Another great lesson Gilgamesh learns is the inescapable truth of human death. He resents the gods' immortality, and when Enkidu dies a painful death, Gilgamesh becomes even more terrified of the idea of his own death. His second quest into Utnapishtim, an attempt to escape death, teaches him that even though humans die, humanity still lives on.
Both Gilgamesh and Enkidu learn that the gods are dangerous to deal with, as they can behave emotionally and irrationally. Through the great flood, they learn that the actions of the gods cannot be understood by humans. In Mesopotamia, piety and respect for the gods are not obligations but rather a practical acknowledgment of the power of nature and a reminder of humanity's role in the greater scheme of things.