First, I don't know where you got the notion that roam is always intrasitive. As you can see by looking at this dictionary entry, the verb can be used both transitively and intransitively.
That said, I can't understand what the close votes are all about. Had you simply asked, "Is roam a transitive verb?" I'd agree – that's answerable with a good dictionary. However, I think your question is a fair one and a tough one – even if it does have a slightly misleading title.
One transitive definition of roam is:
- To wander over or through: roamed the streets.
While an intransitive meaning is:
- To turn the attention from one subject to another with little clarity or coherence of thought: I could hear the speaker, but my thoughts were roaming.
So, perhaps your question is asking something like, "Is it okay to use the transitive definition when dealing with something abstract, such as your thoughts?"
I have no problem with this sentence:
At the time of sleeping or praying, thousands of words wander through my mind.
So, by virtue of the dictionary's definition, your original use roam should be acceptable – yet, for some reason, it does sound a little awkward to me. I think it sounds better with the preposition through:
At the time of sleeping or praying, thousand of words roam through my mind.
That said, I'll add two more recommendations: (1) I'd change the beginning of the sentence from "at the time of" to "while"; and (2) "thousand of words" should either be "thousands of words, or "a thousand words (with no of)". The first recommendation is just a suggestion (my way sounds more idiomatic, I think), but my second recommendation absolutely needs to be fixed:
While I'm sleeping or praying, thousands of words roam through my mind.