Ultimately, the reason your players kill your villains is because they know, deep down, that it's the right thing to do.
Now, I don't mean it's the moral thing to do. I mean it's the pragmatic thing to do. The players (if not the characters) have read enough stories and seen enough movies to know that if they have the bad guy in their power and they don't take the opportunity to kill him - not lock him up, not let him go with a warning - kill him and then burn the body - that he'll come back to threaten them again later. And he'll probably have an extra arm or be an initiate of an assassin order or something the second time round.
Basically, according to storytelling conventions, not killing your enemies usually leads to future trouble. Thus there's an inherent (out-of-character) incentive to do so. You'll need to accept this incentive exists and give your players reasons to not kill your villains despite it. Effectively, you need to put something on the other side of the scales, something that either incentivises not killing your villains or disincentivises killing them.
What can you use as disincentives? It can be a different thing each time. Sometimes, it will be a combination of things. Here are a few, but it's far from an exhaustive list.
It's inherently difficult: Hey, some people are hard to kill. Liches have a phylactery that needs to be destroyed. Rakshasa just pop back up somewhere else in the world after you kill them. Trolls need fire or acid to be disposed of. And don't even get me started on vampires. This doesn't mean the players can't kill them - you should make sure your players know beforehand that the bad guy is a lich and liches regenerate, but does mean it'll take time, effort, and resources that they might not have or might not be willing to spend. The choice here is simply "is this guy really worth it?"
They don't want to die: What if the villain just gives up on this particular plan? I mean, it's not the most glorious decision, but a villain who runs away is a villain who lives until the next time they meet the heroes and they make a point of blocking the escape route. Note that making a villain run away not be an ass-pull means somehow establishing that the villain is more concerned about their overall success (or at least their survival) than the success of their current scheme. The choice here is also "is this guy really worth it", but it's worse, because the players aren't just talking about defeating the villain, they're talking about hunting down and killing him even after they've thwarted his plan entirely, just to be sure that he doesn't theoretically come up with a new one at some point.
They're worth keeping alive: Maybe the villain has information that could help the players. Maybe there's a monetary reward for their capture, or they were specifically tasked to capture this notorious criminal rather than kill them. Villains who are capable of planning for failure will prepare things to bargain for their lives - items they can trade that can't be gotten if they're killed, offers to assist the heroes achieve other goals. The choice here is "is it actually worth missing out on a shiny or useful thing in order to ensure we never meet this guy again?"
It's the right thing to do: Never underestimate the power of actual morality. Players are smart, rational, conscience-less operators but many characters are supposedly Good People who might feel bad about killing (well, about killing people with names). A villain who formally surrenders before the PCs even get to stabbing him, drops to his knees and begs for mercy, swears on his honour never to do it again, and sobs as he tells them he only did it because he was a fool who let power get to his head is a villain who even the Chaotic Neutrals might just refrain from summarily executing them. Or at least they might drag them back to face justice instead (and then they might, say, escape from prison). The disincentive here is that players will have to explicitly Do A Mean Thing in order to kill them; the choice is "am I willing to act like a villain (or at least a jerk) in the name of ensuring we never meet them again?"
It'll cost you innocent lives: Some can tell when heroes have shown up to wreck their plans and react accordingly. The smart ones come up with a backup plan for when they start losing. A good example of this is the classic "hero's choice": catch the villain, or save the hostages? In fiction, nine times out of ten the hero saves the hostage. In RPGs, nine times out of ten the players try to split the difference and do both - but hey, at least the villain might have a fighting chance of getting away if half the party is busy rescuing the hostages. Or rescuing that nearby peasant village from the monster the villain just told them he dispatched. Or whatever.
It'll cost you social standing: Murder, looting aside, is a costly business. It's usually illegal - even if the person you're killing is really bad, in a civilised society killing someone usually draws trouble down on you (justifying why you did it to the authorities, proving he was actually really bad, etc). Let alone killing the Grand Vizier in the middle of the court or the Drow Ambassador at a diplomatic conference. Yes, even though they were using the cover of legitimacy to further their evil schemes! The choice here is "am I willing to be a pariah and possibly make an enemy of a bunch of misguided Good People just to ensure we never see this guy again?"
It'll cost you your victory: The villain is the leader of a fanatic religious movement. Killing him will just turn him into a martyr and empower his followers - you need to expose him as a hypocrite. The villain is the leader of a barbarian horde. Kill him and one of the others will just take his place, but defeat him in battle and he will respect your strength and leave to seek easier conquests. The villain is a twisted madman who kills without mercy, but he was once a mighty hero and turning him back to the side of good would be the true victory. The choice here is the starkest one: "am I willing to fail at my overall objective just to ensure we don't have to meet this guy again". Use it sparingly.
And ultimately, remember that no matter what you're doing, you're still giving your players a choice. The players will (eventually) probably succeed at whatever they put their minds to. That's what player characters do. If they step past whatever disincentives you give them and kill the bad guy regardless, there's not much you can do but let him die. Maybe he tries to run, maybe they have to hunt down and break his life-giving artifact, maybe it destroys the fragile peace between the Dwarves and the Merfolk, but they'll do it in the end.
Then let them deal with the consequences.
(And maybe bring him back six games later as an undead monster, bent on revenge.
You can get away with that sort of thing once or twice, just don't make a habit of it.)