The big moral lesson that Gilgamesh learns in The Epic of Gilgameshis to be a kinder, better, wiser king. Instead of running off to fight monsters and seek immortality, the Epic is saying that the key to living the most meaningful life you can is to be the best version of yourself toward the people around you, and accept your limitations.
There are many other morals to be taken from the epic as well. One is undoubtedly that immortality (the way Gilgamesh desires it) is impossible to achieve. Because it was Enkidu’s death and Gilgamesh’s fear for his own death that set him on his quest, the real moral here is to accept that death will come, and if possible, not to fear it.
The power of friendship is also a big theme in Gilgamesh. Enkidu is the catalyst for change within Gilgamesh’s character. Before his arrival, Gilgamesh is essentially alone. He is the king of Uruk with nobody to match him physically. When Enkidu arrives, however, the two become friends and Gilgamesh learns to care about someone other than himself.
A lesson that might not feel so pertinent anymore but certainly was at the time was warning about hubris. Even though Gilgamesh and Enkidu defeat the Bull of Ishtar, the Epic teaches that it is wrong and foolhardy to try to topple and oppose the gods.