Lanathar -- You haven't done anything wrong.
The rest of Warped Savant's post is most excellent, but this part is most likely not correct.
If you hadn't done anything "wrong" you wouldn't have posted here seeking help. Or consolation.
I had seen your post ahead of your group's latest session and had intended to post some advice but my life went sideways and... So maybe it's my fault?
The challenge of GMing this game as the levels go up is that the permutations of possible outcomes expands exponentially (not to go all mathematical) and the GM difficulty scales accordingly. But just because its harder doesn't mean it doesn't need to be done.
First thing that can help is the players themselves. Player groups, at least within the bounds of one campaign, tend to fall into patterns that they repeat over and over again (because they work.) So if your group has used combat to solve every problem, you can be confident they aren't going to suddenly try to use Diplomacy to convince Thrune to leave the city. (Very simple and weak analogy.) This should make it easier to predict what they're going to do.
Does your group have a history of scouting ahead? Did they before entering the Temple? They isn't to say that they should have or shame on them for not doing it. Everyone plays their own way and it's neither right nor wrong that they did or did not scout out the Temple ahead of time. But if they didn't, you (the GM) need to scale back accordingly. They didn't prep for specific enemies, they don't know how many enemies are there, they don't know which enemies are there, etc. You need to be judicious in hogpiling them with waves of opponents. Here, written tactics - alarm responses, etc. - in a published adventure can be most harmful. You need to consider whether your group is ready for all the respondents the AP suggests should show up and when they show up.
Here your players did you a massive disservice - does your group normally try to exploit 3 dimensions? The game system makes that hard so I would guess not. One pc moving from the balcony to the main floor when the rest of the pc's had either no means or interest in following is simply suicide. It violates the Golden Rule of D&D - Never split the party. At that point, you needed to go All Stop - no more NPC's join the fight until the party is re-united, regardless of what the published response dictates.
This is why the AP appears to encourage the pc's to explore the rooms around the perimeter, maximize the number of encounters that are static. This is in part because rousing the entire Temple is a bad idea, but also because describing all the various possibilities of response would be impractical in a published adventure. Sadly that means the work of figuring out that response and its cadence falls to you. And it's on you if you get the cadence wrong - dump too much on the pc's.
Warped Savant and roguerouge gave excellent advice - get some of the NPC's off the field immediately. Thrune took 100 hp? That's half his hp! Have him retreat to safety - he's got a wand of cure critical wounds - time to burn through those charges. Have other NPC's flee/retreat while calling out for reinforcements. This a) gets them off the battlefield and b) gives your players a hint - there are more enemies in the area. You also need to figure out some way for the group to be re-united. Without knowing a lot more about them, that's hard to suggest, but it's literally your #1 priority.
Whether the pc's retreat or press on, you need to organize the Temple's residents into logical groups (patrols in Warped Savant's post) and only send them at the pc's as they can tolerate. If the pc's vaporize 1 group in 1-2 rounds, feel free to sent two groups at once, but if they get bogged down with one group (bad rolls, poor tactics) do not send two more groups at them after 2 rounds just because "the schedule says so."
If the pc's do retreat, you need to find a way to make the schedule work to get rid of those negative levels. They both weaken the party in practice and, as your own words suggest, leave them skittish in play. The AP has a weakness - perhaps a better word would be ambiguity - and I think this may have been making things harder for you. But you can turn it to your advantage. The AP provides information about the Mephisto Manifestation but it doesn't tell the pc's important information like how long it takes or that the Temple residents start it immediately after Thrune retreats there. So unless the pc's have run missions against the Temple or otherwise scouted it, they don't know those details. Here I will assert my own GMing principle - it's okay if the players assume there is urgency when there isn't, and it's okay if the players assume there is urgency when there is, but if there is an actual clock ticking down, with BAD outcomes if it reaches zero, that clock had damn well better be visible to the pc's. Otherwise the GM is a Richard. So regardless of what the AP says, the ritual in your version had better take longer than it will take your pc's to mount at least two assaults on the place. And any effort your pc's expend to find out the details - scouting, rebellion missions, commune etc. should pay off with accurate information.
If your pc's picked up the negative levels as a result of horrible decisions (reckless, selfish, stupid, etc.) it's perhaps okay for them to carry them forward as a form of punishment, but otherwise the campaign should be paced to let the pc's get to full health before taking on one of the most important structures in the entire AP. Just because the AP says Grivenner can start making caster level checks after 3 days doesn't mean that's how it has to work in your campaign. Maybe it takes 12 (I mean he is summoning 6 pit fiends to do his bidding) - your players haven't read the AP they don't know you changed it. (Umm, hopefully they haven't read it :)