Messi's current deal ends in June 2018 and contains a release clause of 250 million euros. Talks on an improved deal have been ongoing since last autumn, when it became clear that teammate Neymar and Real Madrid's Cristiano Ronaldo were imposing on his status as the world's best-paid player.
As talks dragged on there was even speculation over recent months -- dismissed last week by Messi himself as "crazy stuff" -- that the Barca board had considered putting the 26-year-old up for sale to use the 250 million euros for a complete overhaul of the squad this summer.
Clubs including Manchester City, Chelsea, Paris Saint-Germain, Bayern Munich and even Real Madrid were mentioned as possible new destinations for the four-time Ballon d'Or winner.
However, a statement on the club's official website on Friday morning read: "FC Barcelona has reached an agreement to adjust the terms in the contract binding Leo Messi to the club as a professional first team player. The revised and updated contract will be signed over the next few days."
The details of the contract have not been confirmed, but Spanish newspaper El Pais claims he will receive a pay-rise from 13 million euros to 20 million euros net a season, with the length of the deal and the 250 million euro release clause to remain the same.
Barca coach Gerardo Martino said the development was excellent for everyone at the Camp Nou.