God used dreams and visions several times in the Bible to communicate with people—both His followers and others. They seemed to be common enough that their lack was sorely noted, whether because there were no prophets to have them (1 Samuel 3:1) or because the one seeking guidance had disobeyed God (1 Samuel 28:6).
How are dreams and visions used in the Bible?
God used visions in the Old Testament for several different reasons: to reveal His plan, to protect His plan, and to put people in places of influence.
Abraham (Genesis 15:1): A vision is basically a dream God gives someone when they are awake (Numbers 24:4). God used a vision to remind Abram that he would have a son and he would be the father of many nations.
Abimelech (Genesis 20:1-7): Abraham's wife Sarah was beautiful—so beautiful that when Abraham came into a new area he occasionally got fearful that the local ruler would kill him and take Sarah for his own. On two different occasions, with Abimelech king of Gerar and with Pharaoh, he told them that Sarah was his sister (she was his half-sister). In Genesis 20, God sent a dream to Abimelech telling him not to touch Sarah because she was also Abraham's wife. The dream protected Sarah and protected God's plan for Sarah to be the mother of His chosen people.
Jacob (Genesis 28:10-17): Jacob, with his mother's help, compelled Esau to relinquish his firstborn inheritance. When Rebekah heard that Esau was mad enough to kill Jacob, she sent him to her brother Laban's to wait out Esau's anger—and to find a wife. On his way, he had his famous dream of a ladder reaching to heaven on which angels ascended and descended to and from earth. He also received God's promise that Abraham's blessing would pass through him.
Jacob II (Genesis 31:1-16): Jacob did find a wife with his mother's family—two, in fact—although his uncle tried to cheat him. In order to make sure Jacob had enough assets to support his family, God gave Jacob another dream (or vision?) that told him how to receive his rightful pay for the work he'd done for Laban.
Joseph (Genesis 37:1-11): Joseph was one of the most famous dreamers, and one of the most famous dream-interpreters, in the Bible. His first recorded dreams are found in Genesis 37. They symbolically showed that at some point in the future Joseph's family would bow to him in respect. His brothers didn't appreciate the dream and sold him to traders. Eventually, Joseph ended up in prison in Egypt.
Pharaoh's cupbearer and baker (Genesis 40): Some of the first dreams Joseph interpreted were those of Pharaoh's cupbearer and baker, whom he met in prison. With God's guidance, he explained that the cupbearer would return to Pharaoh's service, but the baker would be killed.
Pharaoh (Genesis 41): Two years later, the Pharaoh himself had a dream. God used the opportunity to raise Joseph to second in command of all Egypt and to save the Egyptians and the Israelites from a horrible famine.
Jacob III (Genesis 46:2-4): Later, when Joseph invited his father and family to wait out the famine in Egypt, God sent Jacob a vision to reinforce his decision to go.
Balaam (Numbers 24:2-9): Despite the insistence of his employer, Balak king of Moab, Balaam could only report what God allowed Him to see—that God would bless Israel and curse her enemies.
Samuel (1 Samuel 3): Samuel had his first vision as a young boy, telling him that God would judge his sinful mentor Eli. God continued to speak to Samuel throughout his whole life.
The Midianite and Amalekite armies (Judges 7:12-15): Gideon did not need a dream to tell him to rout Israel's enemies; God had already sent an angel with a direct message in Judges 6:11. But Gideon wasn't convinced. To bolster his confidence, God had Gideon wander through the enemy camp at night, where he heard a dream and interpretation that predicted he would win the battle.
Nathan (1 Chronicles 17:3-15): Despite the fact that David was "a man after God's own heart" (Acts 13:22), God still chose to use Nathan the prophet to speak with David. In 1 Chronicles 17, Nathan relayed the information that David was not to build a temple, but that God would make David's descendant king forever.
Solomon (1 Kings 3:5 NASB): It was in a dream that God gave Solomon the famous offer: "Ask what you wish Me to give you." Solomon, of course, chose wisdom.
Daniel (Daniel 2; 4): Like Joseph, God allowed Daniel to interpret a foreign ruler's dream in order to place him in a position of power and influence. This is consistent with God's propensity to use miracles to identify His messengers. Daniel had many dreams and visions, himself, mostly related to the future of the nation of Israel.
Visions in the New Testament also served to provide information that was unavailable elsewhere. Specifically, God used visions and dreams to identify Jesus and grow His church.
Zacharias (Luke 1:5-23): As with Abraham, God used a vision to tell an old man he would soon have a very important son. Not long after, Elizabeth had John the Baptist.
Joseph (Matthew 1:20; 2:13): Joseph, engaged to Mary, was a good man. When he found that Mary was pregnant, he meant to divorce her quietly and not draw any public attention to her shame. God sent an angel to him in a dream convincing him that the pregnancy was His will, and Joseph should go ahead with the marriage. After Jesus was born, God sent two more dreams, one to tell Joseph to take his family to Egypt so Herod could not kill Jesus, and another letting him know Herod was dead and he could return home.
Pilate's wife (Matthew 27:19): Pilate had already tried to free Jesus. His wife affirmed his attempts after she had a dream that Jesus would bring them a lot of problems.
Ananias (Acts 9:10): It would have taken nothing less than a vision from God to convince Ananias, a Christian, to invite Paul, the persecutor of Christians, into his home. But because he was obedient to God's leading, Paul regained his sight and found the truth about those he was trying to kill.
Cornelius (Acts 10:1-6): It took quite a while after Jesus' ascension for His disciples to really understand that salvation was for the Gentiles as well as the Jews. To help them get the point, God found an Italian centurion who feared the God of the Jews, and gave him a vision to invite Peter to stay with him.
Peter (Acts 10:9-15): While Peter was resting on this centurion's roof, God gave Peter a vision of food lowered on a sheet. The vision served to show not only that Gentiles could follow Jesus, but that Christians were not bound by the kosher law.
Paul: Paul had several visions in his missionary career. One sent him to preach in Macedonia (Acts 16:9-10). Another encouraged him to keep preaching in Corinth (Acts 18:9-11). God also gave him a vision of heaven (2 Corinthians 12:1-6).
John (Revelation): Nearly the entire book of Revelation is a vision John had while exiled on the island of Patmos. It further explains the future that God had showed Daniel.
With the completion of the Bible, God does not have to use dreams and visions as much as He did before. That is not to say that He cannot or does not; God can communicate with us however He chooses. But when we have a decision to make, our first stop should always be the Bible, not a dream.
Should believers expect visions to be a part of their Christian experience?
Is there such a thing as Christian dream interpretation? Are dreams from God?
What is sleep paralysis with false awakening? Is it a spiritual attack?
What is lucid dreaming? Is having a lucid dream a sin?
How can I recognize the voice of God?