Alonso won back-to-back world titles with Renault in 2005 and 2006, but the legendary Spaniard has failed to register a top-10 finish in the drivers' standings in his last three years with McLaren.
The veteran has also shown an interest in driving away from Formula 1 - winning Le Mans earlier this year - and that is one of the reasons why the 37-year-old has opted for a new challenge.
Alonso is quoted by the team's official website as saying: "After 17 wonderful years in this amazing sport, it's time for me to make a change and move on. 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.
"There are still several grands prix to go this season, and I will take part in them with more commitment and passion than ever. Let's see what the future brings; new exciting challenges are around the corner. I'm having one of the happiest times ever in my life but I need to go on exploring new adventures.
"I made this decision some months ago and it was a firm one. Nevertheless, I would like to sincerely thank Chase Carey and Liberty Media for the efforts made to change my mind and everyone who has contacted me during this time."
Alonso has won a total of 32 grands prix and recorded 97 podiums during an illustrious 303-race career.