"And he brought him up to Bamoth-baal" (Numbers 22:41). Balak was a master of divinations and enchantments more than Balaam, for Balaam walked after him like a blind man. This was because Balak foresaw the future, that Israel were destined to sin with Baal-peor, so that the Holy One, blessed be He, would remember that iniquity against them, and would also allow them to be cursed.
Why Balak Outranked Balaam in Divination at Bamoth-baal
Midrash Aggadah, Numbers 22:41
ויעלהו במות בעל. בלק היה בעל קסמים ונחשים יותר מבלעם, שהיה בלעם הולך אחריו כסומא, לפי שהיה בלק רואה עתידות שישראל יהיו עתידין לחטוא בבעל פעור, כדי שיזכור להם הקב"ה אותו עון, וגם יניח להם לקללם: