The relationship between Gilgamesh and Enkidu is essentially a partnership of equals.
Enkidu is both a loyal friend and a civilizing influence on Gilgamesh. He does not hesitate to confront Gilgamesh when the latter crosses the boundaries of decency. Although Enkidu is bested by Gilgamesh in a physical tussle, he accepts Gilgamesh's superiority without malice. It is Enkidu's good nature that wins Gilgamesh over.
Enkidu is a foil for Gilgamesh, of course. Often, Enkidu is the voice of reason in this partnership of equals. It is Enkidu who interprets Gilgamesh's dream and implores the latter to accept his destiny. Enkidu warns Gilgamesh that he will be a formidable warrior king but never realize his ambitions for immortality.
Enkidu's cautious nature is only exceeded by his loyalty. When Gilgamesh expresses his desire to fight the evil Humbaba, Enkidu initially balks. He warns that Humbaba's strength poses an insurmountable challenge to them both and that the giant is a formidable adversary. However, Gilgamesh waves aside Enkidu's fears, telling the latter that he will head the mission to rid the earth of Humbaba. Seeing Gilgamesh's resolve, Enkidu takes heart and decides to join the fight. Later, however, as the confrontation with Humbaba seems imminent, Enkidu again wavers.
Gilgamesh is unperturbed. He promises Enkidu he will fight by his side and tells him to cast aside his fear. Gilgamesh reminds Enkidu that they share the same morals, perspectives, and warrior ethos. Neither of them will be at peace if they leave the fight unfinished. Interestingly, during the battle with Humbaba, it is Enkidu who rallies Gilgamesh during the most crucial moment. Enkidu's admonishment inspires Gilgamesh to completely defeat Humbaba, instead of sparing him from death.
After the battle, however, Enkidu finds himself under a curse. The gods decree that one of the friends must die. They are angry that, in destroying Humbaba, the friends also killed the Bull of Heaven. Despite his grief, Enkidu willingly accepts the judgement of the gods. At his deathbed, Gilgamesh mourns his friend. It can be argued that Enkidu's relationship with Gilgamesh is beneficial because it is the driving force behind their greatest acts of valor.
At the beginning of the tale, Gilgamesh is a terrible king. He mistreats his subjects and shirks his responsibilities as a ruler. He does not appear to have any close friends or any real purpose to his life. The gods create Enkidu as a friend for Gilgamesh. Their friendship changes Gilgamesh. Enkidu intervenes to prevent Gilgamesh for asserting his right to deflower virgin brides, and causes him to be a better and more just ruler. He also becomes a friend to Gilgamesh and gives him a sense of purpose. Their friendship is so profound as to constitute a form of (nonsexual) love. On the negative side, just as Gilgamesh achieves profound joy in his friendship with Enkidu, he experiences profound sorrow at his death. Nonetheless, the friendship is ultimately beneficial, as it makes Gilgamesh a better person.
From the point of view of Enkidu, he was created by the gods as a friend for Gilgamesh; without that purpose he would not have existed. In the beginning of the story, he is almost as much a beast as a man, living in nature. To a degree his life without Gilgamesh is one of contentment, but it is limited. Since Enkidu does sacrifice his life for Gilgamesh, we could argue that Gilgamesh benefits most from the relationship, but in the cultural context in which the story was written, the fame and deep bond brought by their friendship and shared exploits makes the friendship beneficial overall.