Capaldi made the surprise announcement on Jo Whiley's BBC Radio 2 show, saying: "One of the greatest privileges of being Doctor Who is to see the world at its best.
"From our brilliant crew and creative team working for the best broadcaster on the planet, to the viewers and fans whose endless creativity, generosity and inclusiveness points to a brighter future ahead.
"I can't thank everyone enough. It's been cosmic."
The 58-year-old actor will return in the 10th series of the relaunched show, starring in 12 episodes starting in April, followed by the Christmas special.
His final series will coincide with that of writer and executive producer Steven Moffat.
Moffat said: "For years before I ever imagined being involved in Doctor Who, or had ever met the man, I wanted to work with Peter Capaldi.
"I could not have imagined that one day we'd be standing on the Tardis together.
"Like Peter, I'm facing up to leaving the best job I'll ever have, but knowing I do so in the company of the best, and kindest and cleverest of men, makes the saddest of endings a little sweeter.
"But hey, it's a long way from over. Peter's amazing, fiery, turbulent Doctor is still fighting the good fight, and his greatest adventures are yet to come. Monsters of the universe, be on your guard – Capaldi's not done with you yet!"
Charlotte Moore, director of BBC content, said: "Peter Capaldi will always be a very special Doctor to me; his adventures through time and space started just as I arrived on BBC One.
"He has been a tremendous Doctor who has brought his own unique wisdom and charisma to the role. But, it's not over yet – I know the next series is going to be spectacular."
Capaldi replaced Matt Smith as the Twelfth Doctor.
Speculation has already started about who might take over the role from Capaldi, with Ben Whishaw being named a favourite by bookmakers.