Messi's current deal runs until June 2016 and the new agreement will keep him at the Nou Camp beyond his 31st birthday.
The forward has enjoyed an extraordinary year, even by his own remarkable standards, netting his 89th and 90th goals of 2012 at the weekend.
The 25-year-old had already surpassed Gerd Muller's 40-year-old record of 85 goals in a calendar year.
He is also in contention to claim a fourth successive FIFA Ballon d'Or crown, being named on a three-man shortlist alongside Cristiano Ronaldo and team-mate Andres Iniesta.
Defender Puyol's contract was due to expire at the end of the season, while midfielder Xavi's ran out the following summer.
Their new deals are set to keep them at Barca for the rest of their careers and underline their commitment to the runaway Primera Division leaders under new coach Tito Vilanova.
They also reduce the chances of former boss Pep Guardiola being able to tempt them away if he returns to club management next season.
A statement on the Barcelona website read: "This news means that FC Barcelona has secured its ties with three of its most important players. Over the course of the next few weeks, Carles Puyol, Xavi Hernandez and Leo Messi will all be signing their respective new contracts."
Details of the contracts have not been released, but board spokesman Toni Freixa said "some had been improved and others not".
He added to reporters: "This is extraordinary news that Barca are celebrating."
Messi and Puyol have both won five league titles, three Champions League crowns, two Copa Del Rey titles and two FIFA Club World Cups with the club. Xavi has won six Spanish titles.
Messi, who has scored twice in each of his last six league games and netted 19 in his last 10, will play his final match of the year at Real Valladolid on Saturday.
A delighted Cesc Fabregas, while also recognising that highly-rated winger Cristian Tello had on Monday put pen to paper on a new contract with Barca, tweeted: "Great news for FC Barcelona! Very happy for the renewals of @ctello91, @Carles5puyol, Leo and Xavi!"
Fellow Barca midfielder Javier Mascherano was of a similar opinion, writing on his Twitter account: "Congratulations Puyi, Xavi and Leo for the renovations, great news for the team!!!"