What does "gates of hell" mean in Matthew 16:18? Matthew 16:18 (KJV):


  And I say also unto thee, That thou art Peter, and upon this rock I will build my church; and the gates of hell shall not prevail against it.


I take it "gates of hell" is a metaphor (there are no literal gates to Hell, are there?), but what is it a metaphor for?
The Greek word is πυλαι and does literally mean "gates", and this is the only reference to the gates of Hades/Hell in the NT. It's also the first use of the word εκκλησια, "the called-out", "church".

The gates of a city are the point at which attackers lay siege, the weakest point. The strength of a city is directly related to the strength or power of its gates. Here Hades or hell is represented as a city with its strength in its gates. The gates represent the power of hell, and the Church is stronger.

Gates also keep people in. Jesus may be referring to his death: Hades could not contain him, and it will not contain the Church either, those who are called out to belong to Christ. The Church will never succumb with the physical death of its members and fail; it will never die.