13 Now when they had departed, behold, an angel of the Lord appeared to Joseph in a dream and said, “Rise, take the child and his mother, and flee to Egypt, and remain there until I tell you, for Herod is about to search for the child, to destroy him.”
19 But when Herod died, behold, an angel of the Lord appeared in a dream to Joseph in Egypt….
22 But when he heard that Archelaus was reigning over Judea in place of his father Herod, he was afraid to go there, and being warned in a dream he withdrew to the district of Galilee.
Matthew 2:13, 19, 22 (ESV)