In John 10 Jesus use two images. First he is the gate for the sheep.
John 10:7-10 (NIV):
Therefore Jesus said again, “Very truly I tell you, I am the gate for the sheep. All who have come before me are thieves and robbers, but the sheep have not listened to them. I am the gate; whoever enters through me will be saved. They will come in and go out, and find pasture. The thief comes only to steal and kill and destroy; I have come that they may have life, and have it to the full.
Second he is the good shepherd.
John 10:11-13 (NIV):
“I am the good shepherd. The good shepherd lays down his life for the sheep. The hired hand is not the shepherd and does not own the sheep. So when he sees the wolf coming, he abandons the sheep and runs away. Then the wolf attacks the flock and scatters it. The man runs away because he is a hired hand and cares nothing for the sheep.
There is an old explanation that this is not two different parables of what Jesus is, but one. The explanation is that the shepherd is lying down as a gate to the sheepfold to keep the wild animals out. It's a nice story, but is it just some old preacher story or is it any truth to it? Could it be proven historical or even shown as a practice that is still in use?
I know that this is not the most important question regarding the text. But I hate to pass on stories that can't be verified.
Commentaries on the subject
The only one of my (limited set of) commentaries that address this question is F. F. Bruce*:
There is a patent problem in these words, placed as they are in their present context. In the preceding and following verses Jesus speaks of himself as the shepherd who calls his sheep and leads them out of the fold to the fields where they may safely graze; here he speaks of himself as the door through which they enter and leave the fold. It will not help to invoke the possibility that the shepherd himself lay by night across the entrance to the fold, making himself a sort of living door, so that no one could go in or out without him being aware of it: The parable speaks of a porter or doorkeeper whose business it was to guard the entrance and prevent any unauthorized person from getting in (verse 3).
Bruce rules out the possibility of the shepherd being a living door. That's his opinion.
*: Bruce, F. F. "The Gospel of John", Eerdmans, 1983, p. 225.