Wales coach Gatland, who led the Lions to a series victory over Australia in 2013 and a drawn series against New Zealand in 2017, was widely expected to be given the role despite saying two years ago that it was time for someone else.
He was also an assistant to Ian McGeechan - the only other man to have coached the Lions on three different Tours - when they last toured South Africa, losing the 2009 series 2-1. The Lions won the previous series there, also under McGeechan, in 1997.
"I'm hugely honoured and delighted to lead the Lions again," said Gatland. "It is exciting and a great challenge.
The Lions rightly have a truly special place in the game and I jumped at the chance to be involved again when I was approached about the role.
Gatland, 55, will stand down as Wales coach after this year's Rugby World Cup in Japan having become the country's longest-serving coach (12 years) and leading them to three Grand Slams.
"I'm delighted to now have everything in place to begin full-time in August 2020 as that gives me the best possible chance to plan for South Africa," Gatland said. "But for the time being my focus is entirely on the World Cup and delivering a successful campaign for Wales."