Ray Ozzie, currently chief technology officer, will take over the position, Gates said in a press conference at the company's headquarters.
Gates plans to focus on the Bill and Melinda Gates Foundation. "This is not a retirement, it's a re-ordering of my priorities," he said.
"The company is as strong as it has ever been. Microsoft will play just as important a role as it has in the past 30 years."
Gates co-founded Microsoft in 1975 and served as the company's chief executive until 2000. As Microsoft's software grew to dominate the world's computers, Gates became on of the most visible executives in the software industry.
Gates downplayed the impact that his departure would have on the company. " There's been an over-focus on my individual contribution," he said.
"If you look at the innovation and name any of our products, I'm not the primary person maintaining those products. This company has plenty of brilliant IQ to make brilliant, innovative software."
Gates donated about half of his fortune to the Bill and Melinda Gates Foundation in 2000, and has said that he plans eventually to donate the majority of his fortune to the charitable foundation.
Microsoft has been under pressure from investors for the past year. The software developer was repeatedly forced to delay the launch of its forthcoming Windows Vista operating system.
The company's stock price has been mainly flat over the past four years, and dropped in May.
Microsoft has generally struggled to embrace the internet in its products. The company unveiled a major internet push last year with its Live software initiative.
The project was headed up by Ray Ozzie who in the coming years will gradually take over Gates's chief software architect position.
Ozzie is best known for writing the first versions of Lotus Notes. He joined Microsoft last year when the company acquired Groove Networks, an online collaboration application that Ozzie developed.
Cotton seedling freezes to death as Chang'e-4 shuts down for the Moon's 14-day lunar night
Fortnite easily out-earns PUBG, Assassin's Creed Odyssey and Red Dead Redemption 2 in 2018
Meteor showers as a service will be visible for about 100 kilometres in all directions
Saturn's rings only formed in the past 100 million years, suggests analysis of Cassini space probe data
New findings contradict conventional belief that Saturn's rings were formed along with the planet about 4.5 billion years ago