Fair warning - Lots of old spoilers in this narrative
In the rebirthed Doctor Who, S03E02 “The Shakespeare Code“, the Doctor and William Shakespeare manage to trap the three witch-like Carrionites in their own crystal ball.
The rest of the Carrionites and all the copies of 'Love's Labour's Won' were sucked back through the closing portal and as the Doctor, Will Shakespeare and Martha Jones are sitting on the deserted stage during the episode wrap-up, the Doctor picks up the crystal ball imprisoning the original three witch/Carrionites and says,
Anyway, it's time we were off. I've got a nice attic in the Tardis where this lot can scream for all eternity.
Then Queen Elizabeth shows up and retro-remembers the Doctor (as a spurned lover or jilted bride); the Doctor clearly tucks the crystal ball into his coat before running off and escaping in the TARDIS.
I can remember the head of a Cyberman being used as a compass or homing beacon in a later episode but that endeavour went pear-shaped in quick order. I also remember the TARDIS being used to transport the Margaret Blaine Slitheen but she turns into an egg. I don't recall any other bad guys or gals being imprisoned long term.
Have there been other cases of the Doctor keeping villains imprisoned in the TARDIS for an appreciable length of time (between two episodes up to and including eternity)? Original series, interim movies and rebirth responses apply.
There is evidence that the Doctor was willing to do this at least one more time but things didn't work out.
At ~00:39:35 in S03E13, Last of the Time Lords, there is this exchange of dialogue:
Master: You still haven't answered the question. What happens to me?
Doctor: You are my responsibility from now on. You're the only Time Lord left in existence.
Captain Jack: Yeah, but you can't trust him.
Doctor: No. The only safe place for him is the TARDIS.
Master: You mean ... you're just going to keep me ...?
Doctor: Hmm, if that's what I have to do. <to Captain Jack> It's time to change. Maybe I've been wandering for too long. Now I'll have someone to care for.
<a shot rings out and the Master falls to the ground>
The Master appeared to refuse to regenerate but was never confined within the TARDIS. This would not qualify.
At the end of S03E11 - Utopia, the Master takes control of the TARDIS and abandons the Doctor, Martha Jones and Captain Jack Harkness at the end of the universe. This shouldn't be considered imprisonment of a villain.