Matthew 2:12-13

2:12 After being warned in a dream not to return to Herod, they went back by another route to their own country.

The Escape to Egypt

2:13 After they had gone, an angel of the Lord appeared to Joseph in a dream and said, “Get up, take the child and his mother and flee to Egypt, and stay there until I tell you, for Herod is going to look for the child to kill him.”

Matthew 2:19

The Return to Nazareth

2:19 After Herod had died, an angel of the Lord appeared in a dream to Joseph in Egypt

Matthew 2:22

2:22 But when he heard that Archelaus was reigning over Judea in place of his father Herod, he was afraid to go there. After being warned in a dream, he went to the regions of Galilee.