אַ֥שְֽׁרֵי אָדָם֮ שֹׁמֵ֪עַֽ֫ לִ֥י לִשְׁקֹ֣ד עַל־דַּ֭לְתֹתַי י֤וֹם ׀ י֑וֹם לִ֝שְׁמֹ֗ר מְזוּזֹ֥ת פְּתָחָֽי׃
누구든지 내게 들으며 날마다 내 문 곁에서 기다리며 문설주 옆에서 기다리는 자는 복이 있나니
Midrash Tanchuma
Scripture itself declares: Happy is the man that hearkeneth unto Me, watching daily at My gates, waiting at the posts of My door (ibid. 8:34). This verse indicates that no harm will befall the person who hearkens unto the Torah, for it is written: Whosoever hearkeneth unto Me shall dwell securely and shall be quiet without fear of evil (ibid. 1:33). Furthermore it states: When thou walkest, it shall lead thee (ibid. 6:22).
Ein Yaakov (Glick Edition)
R. Levi said: "Whoever has a synagogue in his town, and does not go there to pray, is to be called a wicked neighbor, as it is said (Jer. 12, 14.) Thus hath said the Lord against all my wicked neighbors; moreover by his actions he causes exile to himself and his children, as it is said (Ib.) I will pluck them out of their land, and the house of Judah will I pluck out from the midst of them." They told R. Jochanan. that there are aged people in Babylon, and he remarked wonderingly, "It is written (Deu. 11, 21.) In order that your days may be multiplied, and the days of your children in the land which the Lord swore unto your fathers, but not outside of Palestine." But when he was informed [of the fact] that they come early to the synagogue, and leave it late, then he said: "Aye, it is this which helps them, as R. Jochanan b. Levi said unto his children, 'Come early and remain late in the synagogue, in order that you may live long.'" R. Acha the son of R. Chanina said: "From what Biblical passage [do we learn this]? Happy is the man that hearkeneth unto me, watching day by day at my gates, waiting at the posts of my doors (Pr. 8, 34), and after this is written. For he who finds me, finds life." R. Chisda said: "A man shall always enter two doors to the synagogue." What does he mean by "two doors"? He means that a man should wait as long as it takes to walk the length of two doors, and then begin to pray.
Devarim Rabbah
Regarding what the verse said: “Happy is the person who heeds me, [to persist at my gates daily, to protect the doorposts of my entrances]” (Proverbs 8:34), what is “happy is the person who heeds me”? The Holy One blessed be He said: Happy is the person whose Torah discourse is for My sake.6The verse is ordinarily read as referring to wisdom or Torah, but the midrash reads it as referring to God. What is, “to persist at my gates” (Proverbs 8:34)? The Holy One blessed be He said: If you go to pray inside the synagogue, do not stand near the outer entrance to pray there; rather, intend to enter an entrance within an entrance;7Meaning, if there are two doors with a small hall between them, do not stay in the small hall, enter through the second door to the large chamber. it is not written, “to persist at my gate,” but is written “at my gates” – two gates. Why is it so? It is because the Holy One blessed be He counts your strides and gives you reward.8You receive a reward for taking the extra steps to enter into the synagogue and not stay in the entranceway. What is “to protect the doorposts [mezuzot] of my entrances” (Proverbs 8:34)? Rabbi Yehuda bar Sima said: Is there a mezuza in synagogues?9It is stated in the Gemara (Yoma 11b) that according to the Sages, synagogues are exempt from the mitzva of mezuza. Rather, just as the mezuza does not move from the entrance, so too, you will not move from synagogues and study halls. The Holy One blessed be He said: If you do so, know that you will receive the Divine Presence. What is written thereafter? “For one who finds Me finds life” (Proverbs 8:35). The Holy One blessed be He said: Who is it who came to the synagogue and did not find My glory there? Rabbi Aivu said: Moreover, when you stand in the synagogue, the Holy One blessed be He stands over you. From where is it derived? It is as it is stated: “God stands in the assembly of the Almighty” (Psalms 82:1). The Holy One blessed be He said: It is not only that you receive the Divine Presence in the synagogue, but you emerge from there laden with blessings. From where is it derived? It is as it is stated: “For one who finds Me finds life, and generates favor from the Lord” (Proverbs 8:35). That is, “it will be if you will heed…”