It depends on whether you think he's teaching things overtly, consciously, or if he's teaching Achilles through his death.
The role he certainly plays is as a plot device. His life, as he dons Achilles' armor, shows the Greeks that the Trojans can be defeated, even though they think it is Achilles doing it. In his death, though, he stirs Achilles to action (some texts have the Illiad's subtitle as "The Rage of Achilles") and he then slaughters the Trojans, ahead of their ultimate doom. The death of Patroclus, then, directly brings about the fall of Troy...eventually.
It's worth mentioning that there is debate about whether or not Achilles and Patroclus are lovers. Some texts say yes, and some say no, but these "cousins" are incredibly close no matter what.