3 “And when you pray,” says He, “you shall not be as the hypocrites, for they love to pray standing in the synagogues, and in the corners of the streets. Verily I say unto you, they have their reward.”
“But you, when you pray, enter into your closet, and when you have shut your door, pray to your Father which is in secret.”
These too again He calls “hypocrites,” and very fitly; for while they are feigning to pray to God, they are looking round after men; wearing the garb not of suppliants, but of ridiculous persons. For he, who is to do a suppliant's office, letting go all other, looks to him alone, who has power to grant his request. But if you leave this one, and go about wandering and casting around your eyes everywhere, you will depart with empty hands. For this was your own will. Wherefore He said not, “such shall not receive a reward,” but, “they have it out:” that is, they shall indeed receive one, but from those of whom they themselves desire to have it. For God wills not this: He rather for His part was willing to bestow on men the recompence that comes from Himself; but they seeking that which is from men, can be no longer justly entitled to receive from Him, for whom they have done nothing.
But mark, I pray you, the lovingkindness of God, in that He promises to bestow on us a reward, even for those good things which we ask of Him.
Having then discredited them, who order not this duty as they ought, both from the place and from their disposition of mind, and having shown that they are very ridiculous: He introduces the best manner of prayer, and again gives the reward, saying, “Enter into your closet.”
“What then,” it may be said, “ought we not to pray in church?” Indeed we ought by all means, but in such a spirit as this. Because everywhere God seeks the intention of all that is done. Since even if you should enter into your closet, and having shut the door, should do it for display, the doors will do you no good.
It is worth observing in this case also, how exact the definition, which He made when He said, “That they may appear unto men.” So that even if you shut the doors, this He desires you duly to perform, rather than the shutting of the doors, even to shut the doors of the mind. For as in everything it is good to be freed from vainglory, so most especially in prayer. For if even without this, we wander and are distracted, when shall we attend unto the things which we are saying, should we enter in having this disease also? And if we who pray and beseech attend not, how do we expect God to attend?
Source: Homilies on the Gospel of St. Matthew (New Advent)