So the most memorable encounter I've run recently was incredibly complicated and took three whole sessions to resolve.
The Premise: One of the bosses of Monster Town, a great beholder and cleric of the Elder Elemental Eye, has called for a meeting of the high priests of different religions -- the heads of the churches of Tiamat, Gruumsh, Mershaulk, Orcus, Ilsensine, Llolth, Kord, and Pelor. Of course the PCs want to know what it's about, so it's convenient that one of them is the high priest of Pelor (and only priest of Pelor in Monster Town). The rest sneak in as his bodyguards and caterers.
The beholder lives in a great buried tower. Each level is circular and in the center of the floor is a circular hole so that the beholder can float up and down to the different levels. The meeting is being held on level 5.
Part I:
Of course it was a setup; it turns out level 5 is the trap level. Half-way through the meeting, a cylinder of force surrounds the central hole in the floor, and walls of force radiate outward from it. The level is separated into eight segments, and parties are split into four of them. A pipe opens in the ceiling of each segment...
On round one, the segments start filling with intellect devourers. The party's hill-giant fighter gets zapped unconscious, but all the devourers are squashed before they can eat his brain. One of the party's barbarians starts chopping a hole in the floor; the other uses boots of spider climb and starts smashing a hole in the ceiling.
On round two, the segments start filling with water, each one with a water weird. The cleric of Pelor fries one with flame strike, but that fills his segment with steam. In one segment, an allied NPC uses control water to reverse the flow, keeping the monster and the water on the ceiling. Water starts rushing through the hole in the floor that the barbarian was chopping... but the unconscious hill-giant gets sucked in, plugging it up.
On round three, harpoons on chains launch from the walls in each segment. The party's tabaxi sorcerer and her yuan-ti friends float above the fray. One of the harpoons strikes an allied NPC, and the party's kenku wizard unwisely tries to use witch bolt against the chain, frying the NPC.
On round four, it turns out the chains are wired, electrifying the water, as well as the friendly NPC. The NPC who was using control water fails a concentration check, submerging that chamber again, bringing in the water weird.
On round five, the water starts filling up with swarms of quippers. Everyone who is unconscious gets to make some death saves.
On round six, each segment gets sprayed with oil, and the electrified chains spark again, igniting the air and the surface of the water. By this point, most of the NPC priests have started using stone shape to create holes under the force walls, turning most of the room into a series of raging waterfalls.
On round seven, each segment starts filling with cement. A "friendly" NPC with a grudge gets tired of the kenku wizard trying to "help" and decides to kill him with an axe, so he escapes by disintegrating the wall of force, washing both of them away in a tidal wave.
Part II:
The party has been swept down to level 4, except for the tabaxi sorcerer who just flies down, and the barbarian who just spider climbs down.
The hole in the center of the room is plugged by a great stone disk. There are four great stone obelisks, which are a creature called "Pillar of the Lost Magocracy" from the Creature Codex. Each starts shooting random weird effects around the room (acid rain, plant growth, etc.).
Meanwhile, 16 kuo-toa start peppering the PCs with crossbow bolts from behind cover. The water in the room is a few feet deep, giving them both cover and a movement advantage against the PCs. But the PCs are high enough level (around 15ish) to take them out, even with the random effects from the pillars.
Suddenly the disk in the center of the room gets disintegrated! The whole room turns into a giant whirlpool, or more like a toilet bowl (the water is pretty foul from all the blood and bodies, plus the oil and cement mix), as everyone starts getting sucked down the hole.
Part III:
The water falls down to level 2, where the hole in the center of the floor is covered by a disintegration field -- it's like a force field, but if you touch it, it deals you 10d6 + 40 force damage and turns you to dust. The disintegration field conveniently disintegrates all the water, dead bodies, etc.
Unfortunately, the party members are sucked down into it. Most manage to swing to the side and avoid the field but a few barbarians take some damage (@#$% damage resistance). The sorcerer just flies down, the barbarian with spider climb just walks down, and the kenku wizard polymorphs into a giant eagle and flies down with a bloodhunter on his back.
Even more unfortunately, the beholder is down there waiting. As the party springs into action, eye rays shooting everywhere, the anti-magic cone turns on the polymorphed wizard -- who turns back into a kenku, falls into the field, and is disintegrated.
The beholder then uses the telekinesis ray to slam the cleric of Pelor onto the field and hold him there, but one of the barbarians runs across the field (voluntarily taking more damage) to push the cleric off the field. Another barbarian runs up the wall, onto the beholder's head (body?) and cuts off the telekinesis eye stalk.
Meanwhile the sorcerer is pouring damage into the beholder -- but because he's a beholder cleric, he uses his healing eye ray to bounce back. At the same time, he summons a felad-zerah demon, which has both a petrifying gaze and a whip that pulls characters closer to itself -- right over the disintegration field.
Just when things are looking very bad, the beholder makes the unfortunate tactical error of finding itself within reach of two barbarians and a bloodhunter, and gets chopped to pieces.
Mission accomplished!