I was amazed at how many times dreams were given to people in the bible. Not only around the birth of Jesus but in the old testament also. Clearly God speaks through dreams. In Job 33:14-18 it says, "For God speaks again, though people do not recognize it. He speaks in dreams, in visions of the night, when deep sleep falls on people as the lie in their beds. He whispers in their ears and terrifies them with warnings. He makes them turn from doing wrong; he keeps them from pride. He protects them from the grave, from crossing over the river of death." It is as if God seals instruction through dreams. Even as far back as Genesis God gave Joseph that incredible dream that told him what was in his future. Genesis 37:5-11 He made the mistake of telling the dream to his brothers which invoked jealousy. Maybe that was supposed to happen. Why else would God give a dream like that to a young boy who lacked the wisdom or life experiences? Later on in Genesis God would give Pharaoh a dream and Joseph would interpret it. Genesis 41:1-33.
In the new testament there are many accounts of people having dreams like Joseph (Matthew 1:20-21), the wise men (Matthew 2:12), Pilate's wife (Matthew 27:19), and many more. So as you can clearly see, God speaks in dreams quite frequently.