Alonso, who is ninth in the standings with nine races to go this season, has accumulated 32 wins, 22 pole positions and 97 podiums to date.
"After 17 wonderful years in this amazing sport, it's time for me to make a change and move on," the 37-year-old told his McLaren team's website.
"I have enjoyed every single minute of those incredible seasons, and I cannot thank enough the people who have contributed to make them all so special."

Alonso thanked his teammates and fans, as well as Formula One Group CEO Chase Carey for trying to persuade him to reconsider.
"I made this decision some months ago and it was a firm one," he added.
Alonso made his F1 debut for Minardi at the Australian Grand Prix in 2001 before joining Renault as a test driver in 2002.
The Spaniard's 2005 title ended Michael Schumacher's five-year reign and made him the then-youngest world champion in F1 history, at the age of 24 years and 59 days.
He endured a tumultuous and often acrimonious season alongside Lewis Hamilton at McLaren in 2007 before a brief return to Renault followed by a four-year stint with Ferrari from 2010. He rejoined McLaren in 2015.

Over the years, Alonso has dabbled in other forms of motor racing, mostly endurance related. He finished 24th in last year's Indianapolis 500, and participated in the Daytona 24 Hours race in January.
In June, he won the Le Mans 24 Hours, inching him closer to motor racing's triple crown. Graham Hill is the only driver to have achieved that feat by securing wins at Monaco, the Indianapolis 500 and Le Mans.

While he won't be racing in F1 in 2019, Alonso tweeted an emotional thank you to the sport in the form of a video and poem.
"When I barely knew how to walk, I ran towards your noise, your circuits, without knowing anything about you," he wrote.
"We had very good times, some unforgettable, others really bad. We have played together, against incredible rivals. You played with me, and I learned how to play with you too.
"I have seen you changing, sometimes for good, sometimes in my opinion for bad. Every time i close the visor of my helmet I feel your warm embrace, your energy, there is nothing like it.
"But today I have some other bigger challenges than those you can offer me. And this year, while I am still driving at my best, is how I want to remember you.
"I can only be grateful to you and to the people that are part of you, for having introduced to me so many cultures, traditions, languages, wonderful people, for having been my life.