1. No blobs of just HP and attacks. Attack things other than AC. Force saving throws and skill checks. One of the few times I made my 18th level part run away was when they were investigating an old mine that was set up as a baited trap by a nearby mindflayer city. The paladin looked into a crevice and saw the Intellect Devourer, then failed his INT save. They left and spent the next 2-3 days traveling until he wasn't a drooling idiot.
2. The big ugly ogre/giant types don't just hit for damage. They also force a strength save or get grabbed, strength save or get knocked back into another PC, damaging both and maybe proning.
Dragons get spellcasting. Ever fought an invisible dragon?
3. Important fights need to have interesting terrain and objectives.
4. Non-combat objectives. They're not just there to kill X, they're also there to steal/destroy/fix Y. Now they have to go someplace specific, and deal with the guards, wards, riddles, etc. around it.
5. No solo bosses.
6. Turn it up to 11, they can handle it. The final battle of Against the Idol of the Sun was an avatar of Huitzopochtli (CR 28-30ish, perma-hasted, DC 22 aura of fire & blindness), his high priest (capable of casting 9th level spells), 4-6 lesser priests, 2-4 elite fighters (5 attacks per round, dex to damage, resist most elements, >100hp) and 4-6 melee Aarakocra (don't recall exactly how many) atop a temple in the middle of a city of 100,000, with reinforcements inbound.
The party Reduced a Teleportation Gate ring they found, and used it to bring in about 100 giants as a diversionary attack, while allies attacked the outside of the city, AND they teleported in a kraken they'd made a bargain with. Most of that fighting was off-screen, but it definitely gave them an edge in terms of preventing hordes of reinforcements.
This was a 2-session battle, though.