(Numbers 22:20:) "And God came to Balaam at night." This is what Scripture says (Exodus 12:42): "It is a night of vigil for the LORD to bring them out of the land of Egypt; this is that night." All the miracles that were done for Israel, and the exacting of punishment from the wicked on their behalf, took place at night. (Genesis 31:24:) "And God came to Laban the Aramean in a dream at night." (Genesis 20:3:) "And God came to Abimelech [in a dream at night]." (Exodus 12:19:) "And it came to pass in the middle of the night." (Exodus 14:20:) "And there was the cloud and the darkness, yet it gave light to the night." (Genesis 14:15:) "And he divided himself against them at night." And all of them are a night of vigil.
Why God Came to Balaam at Night and Saved Israel in Darkness
Midrash Tanchuma Buber, Balak 11:1
ויבא אלהים אל בלעם לילה. זש"ה ליל שמורים הוא לה' להוציאם מארץ מצרים הוא הלילה הזה (שמות יב מב), כל נסים שנעשו לישראל ופרע להם מן הרשעים בלילה היה, ויבא אלהים אל לבן הארמי בחלום הלילה (בראשית לא כד), ויבא אלהים אל אבימלך [בחלום הלילה] (שם כ ג), ויהי בחצי הלילה (שמות יב יט), ויהי הענן והחשך ויאר את הלילה (שם יד כ), ויחלק עליהם לילה (בראשית יד טו), וכולם ליל שמורים.