There are at least three sources of dream:
1. The Human Body (The senses being awake to external stimuli while one is asleep).
2. The Soul (Mind, Will, Emotions)
3. The Spirit
E.g. (a) A person hears someone calling his name in a dream; he awakes and finds that someone in reality had been calling his name.
(b) A hungry man sleeps and dreams of eating something; he awakes and finds that it was just a dream.
"as when a hungry man dreams that he is eating, but he awakens, and his hunger remains; as when a thirsty man dreams that he is drinking, but he awakens faint, with his thirst unquenched." (Isa 29:8 NIV)
E.g. (a) A scientist has been thinking a lot about a particular problem; in a dream, the thoughts converge into a solution.
(b) A depressed person experiences dreams of anxiety.
(c) A man has been watching or thinking of erotic themes and experiences the same in a dream or a series of night dreams.
"a dream comes through much activity" (Ecc 5:3 NKJ)
"If I say, 'My bed will comfort me, My couch will ease my complaint,'then You frighten me with dreams And terrify me by visions; so that my soul would choose suffocation, Death rather than my pains. (Job 7:13-15 NAU)
(a) God can speak to a person through a dream. He may speak through a symbolic dream or speak directly in a theophany or speak through an angel. (Gen.20:3; 31:11; Dan.2:1; Matt.2:13)
(b) The Spirit gives dreams (Joel 2:28)
(c) In those who are not regenerated by the Spirit and in whom the Spirit of God doesn't dwell; evil spirits may be able to produce false images (thought-images) as dreams of the mind. The Bible talks of demons being able to inject thoughts in the minds of people (Acts 5:3).
However, there is no proof that the devil can inject thoughts through dreams in the mind of the redeemed. But, it seems from empirical data that evil spirits oppress the not-redeemed in ways that the not-redeemed sometimes experience nightmares.
Few Facts About Spiritual Dreams
1. Symbolic dreams given by God produce anxiety in the spirit to know the interpretation (Dan.2:1)
2. In a spiritual dream, the will of a child of God is not suspended; s/he can usually make a choice (1Kgs.3:5ff) and the choice is honored as if in a dreamless waking state.
3. God may come to us in a dream in order to warn us of something, promise us something, grant us something, or show us something (Matt.2:12; Acts 18:9,10; 23:11 (though this might have been a vision and not a dream); 1Kgs.3:5ff; Dan.2:45).
"And it shall come to pass afterward that I will pour out My Spirit on all flesh; your sons and your daughters shall prophesy, your old men shall dream dreams, your young men shall see visions." (Joe 2:28 NKJ)