This is a short story, I think, but I might be wrong.
A man is recruited to enter an authors' dreams to try & bring him out of a coma & finds himself in a hackneyed barsoom type world where the coma victim is a muscle bound hero, it's a desert world with two suns, the damsel in distress is the typical scantily clad princess trope.
The "hero" basically spoils the authors' dreams by manifesting a pistol & simply shooting the monsters dead at one point & the author tries to write him out of the "story" by simply jumping forward several chapters & is both surprised & peeved to find him still there.
The author eventually comes out of his coma & immediately assaults the man when he recognizes him from his dreams, he tries to strangle him if I remember right.
He enters the authors' dreams with some kind of experimental dream imaging tech, basically a two ECG sort of set up linked through a computer with him put to sleep with drugs I think.