Your pastor is wrong.
Satan can give dreams, and he has invaded my dreams NUMEROUS times, usually with a dream that is either depraved, or "scary". I just had one night before last that was both.
When I am awake, I do not think about anything depraved voluntarily. When one of those evil carnal thoughts rears its ugly head, I cast it right out. I do not look at porno, or do anything of an explicit nature, with the exception of occasionally cussing...and whenever I do, I always turn to God and ask for His forgiveness.
Neither am I afraid of the Devil, because I fight this monster on a daily basis, and he often tries to either "cozy up" to me, or he just insults me hand over fist. But I am never frightened of him, though I DO know not to let my guard down when he's around, because I know what a liar he is. The Word of God confirms this.
When he gives you evil dreams in which you do things you wouldn't do when you are awake, he is lying to you. Praying about it is fine, because God ALSO gives dreams, but not evil dreams that cause you to stumble when you are awake. If you are, in fact, already stumbling, and God is trying to SHOW you how so, I believe He only does this when you are awake. Dreams from God are often prophetic warnings and can often be needed to be interpreted correctly, for the imagery is often profound with a deeper message, and not a sin-laden dream of sex and debauchery, nor a terrifying dream or nightmare in which you are victimized. God does NOT give a spirit of fear. To say that our dreams are in and of themselves sin is incorrect, and your pastor is in error about this.