The prayer begins with Numbers 24:5, where Balaam, sent to curse the Israelites, is instead overcome with awe at God and the Israelites' houses of worship. Its first line of praise is a quote of Balaam's blessing and is thus the only prayer commonly used in Jewish services that was written by a non-Jew. The remainder of the text is derived from passages in Psalms relating to entering the house of worship and preparation for further prayer (Psalms 5:8; 26:8; 95:6; and 69:14). In this vein is the prayer recited by Jews upon entering the synagogue.
מַה טֹּבוּ אֹהָלֶיךָ, יַעֲקֹב; מִשְׁכְּנֹתֶיךָ, יִשְׂרָאֵל. (1 Numbers 24:5
וַאֲנִי בְּרב חַסְדְּךָ אָבא בֵיתֶךָ אֶשְׁתַּחֲוֶה אֶל הֵיכַל קָדְשְׁךָ בְּיִרְאָתֶךָ. (2 Psalms 5:8
Ma tovu ohalekha Ya'akov, mishk'notekha Yisra'el.
Va'ani b'rov hasd'kha, avo veytekha, eshtahaveh el heikhal kodsh'kha b'yir'atekha.
Adonai, ahavti m'on beitekha um'kom mishkan k'vodekha.
Va'ani eshtakhaveh ve'ekhra'ah, avar'kha lifnei Adonai osi.
Va'ani t'filati l'kha Adonai et ratzon, Elohim b'rov hasdekha aneini be'emet yish'ekha.
How great are your tents, O Jacob, your dwelling places, O Israel!
As for me, through Your abundant grace, I enter your house to worship with awe in Your sacred place.
O Lord, I love the House where you dwell, and the place where your glory tabernacles.
I shall prostrate myself and bow; I shall kneel before the Lord my Maker.
To You, Eternal One, goes my prayer: may this be a time of your favor. In Your abundant love, O God, answer me with the Truth of Your salvation.