SPOILERS AHEAD
X2 Castle Amber (BECMI, Expert Level Adventure - 1981)
In room 50, the alchemical laboratory,
...concealed vents will open and begin to fill the room with a black powdery cloud which moves as though it is alive...Every round a character breathes in the fumes or comes into direct contact with the powdery cloud, the character must save vs. Spells or fall asleep...This particular alchemical preparation can cause exceptionally vivid dreams (or nightmares) and has the magical property of possibly making those dreams (or nightmares) come true.
The module asks the DM to make up the dreams caused by the trap, but gives a number of suggestions, many of which involve the players believing that their PC has been transported somewhere else and that what is happening to them is real.
As an example:
A dream that all the plant life in the world suddenly gains demonic intelligence and plans to take over the world. The character is the only person who knows the truth. Fortunately he or she discovers an ancient artifact which, when destroyed, returns the plants to normal. Unfortunately no one will believe the PC’s story.
One of my players' PC's in the 80's had this dream, and to this day he is still bitter that no one believed her.
One of the dreams actually physically transports the PC to another location, where they remain out of play and dreaming unless and until the rest of the party can find them. This most closely matches the original request for a portal trap that simultaneously affects PC's bodies and minds.
A dream of a strange land called Averoigne...The character will disappear from the room and will be out of play, but will awake in the clearing on the far side of the Gate of the Silver Keys at just about the same time that the party actually arrives and opens the Gate.
The module does not say how long the characters sleep in the laboratory, only that regardless of the length or complexity of the dream, they all awake at the same time. Presumably this would give the Amber family, were they still present, the chance to collect and imprison anyone who had intruded on their laboratory.
The Illithiad (Second Edition, 1998)
According to TV Tropes,
The Illithiad has the Microcosm psionic power, which allows an illithid to take over a victim's mind and make them think they have been transported to a paradise-like fantasy world. In fact, they're just standing around not doing anything. The power negates all normal sensory input and the victim can only be brought out of it if they can realize that what their senses are experiencing is false.
Order of the Stick 885-891 (3.5e based, 2013)
The Order triggers an epic-level illusion trap that allows them to each have a 'Happy Ending' to their quest. Most of the party share a common illusion, but Belkar is in a separate illusion because his conception of a happy ending is not shared by the others. It is unclear how long they are trapped, but for "at least a few hours" because it has been long enough for Roy to be really hungry but not so long that he needs to shave. Elan manages to break them out of it when he realizes that while the other's happy endings are at least plausible, his is so stupid and childish that it should never happen, and yet it does. Once they are free, Roy tells Elan that he did well, and Elan is so unused to the complement that he suspects they are still in some sort of illusory wish-fulfillment trap.
Dragonlance: Shadow of the Dragon Queen (Fifth Edition, 2022)
According to TV Tropes,
[T]he mirror of reflected pasts paralyzes anyone who looks into its depths by showing them an idealized version of their own past, unless they make their saving throw to resist the effect.