Are sex dreams our fault, or are they put there by Satan?
What we dream can be a product of what we have been thinking and focusing on, but often there is no connection. If there have been impure thoughts, or if a person has been engaging in sexual fantasies during the day—reading pornographic literature and looking at pornographic pictures, for instance—there is a very good chance that dreams will result.
On the other hand, sometimes it may be simply the product of the work of Satan, but I can’t quote you a verse of Scripture to absolutely support that. Ephesians 6:17 may suggest this in the sense that such dreams might be one form of the flaming missiles that Satan can send our way. Also, check out the Q&As for the comments on the question, “Are our dreams significant?” This might also help.