⚠️ This answer names the endings for Karlach's storyline. Nothing else about the plot is spoiled.
Yes, you can keep Karlach alive — but "saved" is relative. Every ending that avoids her death still sends her back to Hell in some form; none of them let her just stay in Baldur's Gate as herself, free of the infernal engine.
The endings that keep her alive
Two of them send her back to Avernus. Romance her and repair her infernal engine with Dammon, and she'll ask you to come with her after the final battle — the ending closest to "good," since she keeps her mind and there's at least hope of a future cure. If Wyll completes his own questline and becomes the Blade of Avernus instead, he can go with her there in your place.
The third option comes from the Emperor during the final fight: let him turn Karlach into a Mind Flayer, and her engine stops being a threat because her body isn't fully hers anymore. She survives, but this is the bleakest surviving outcome — nothing reverses it, and she risks losing herself over time.
What kills her instead
Skip Dammon's engine upgrades and Karlach burns out right after the final battle. Even with the engine repaired, refusing both paths back to Avernus and the Mind Flayer offer leaves it unstable enough that she dies anyway — at least on her own terms, having refused to go back to Hell.
What changed after launch
The original ending gave her fate one abrupt scene. Larian expanded it twice: a short scene added in the second major patch (August 2023) showed her and Wyll settling into Avernus, and Patch 7 (September 2024) went further, adding a full playable epilogue set six months later with thousands of new companion dialogue lines — including scenes that react to whether she went to Avernus with you or with Wyll.