"Lycidas" was written partly as a tribute to Edward King, one of Milton's college friends, and so it celebrates their friendship, and a bit idealistically, if we may say so. There is a whole back story about how they were shepherds and grew up in the same part of the country, which isn't the true story of their friendship, but rather a metaphor for their close bond. But the poem is much more than just an unqualified celebration of friendship – it's also about the effect of that friendship on the speaker's sense of himself as a poet.
Let us tell you what's really going down: while the poem implies a deep friendship between the speaker and Lycidas, the speaker is using his friend's death to further his own poetic career.
We know that Milton and Edward King were never shepherds, so the metaphor is a merely a coping mechanism for the speaker. He is so devastated by his friend's death that he has to invent a story in order to face it.