When we have lived to old age and done all we can, it will be time to lie down to sleep an endless sleep. metaphor, euphemism, personification.
In my opinion, this is a euphemism. However, you could probably make an argument for it being a metaphor. It is clearly not personification.
What the author is saying here is that after we have lived our whole lives, we are going to die. But the author does not say it directly. Instead, he uses the word "sleep." You can argue that he does this because "sleep" is not a word that makes people uncomfortable where as "die" or "death" is.
Some might argue this is a metaphor, but I think a metaphor would actually have the word "death" in it -- like "it will be time to lie down and sleep the endless sleep of death."
This quote is both euphemism and metaphor. The writer is using "sleep," instead of die or death, which makes the quote a use of euphemism.
But it is also metaphor. What matters in a metaphor is that there is a comparison made. The comparison does not have to be directly stated. In this metaphor, the tenor (what is being described and elaborated on) is death, and the vehicle by which the tenor is explained is "sleep" or "endless sleep." The presence of a comparison makes this a metaphor. The tenor does not have to be directly stated.