Barcelona and Neymar had made the announcement of the agreement in July.
The previous contract was to end in 2018. The new deal will run through June 2021, Barcelona said Monday.
The club's announcement in July ended speculation that Neymar was unhappy in Spain and was looking to move to another club. Paris Saint-Germain was among the clubs reportedly trying to sign him.
At the time, the club said the contract's buyout clause would be fixed at 200 million euros (around $220 million) for the first year of the new contract, 222 million euros for the second, and 250 million euros for the final three years. The buyout clauses reportedly match the ones on Lionel Messi's contract.
The 24-year-old Neymar has been with Barcelona since moving from Brazilian club Santos in 2013. He has scored 90 goals in 149 matches, including five goals in eight matches this season.
A key player in Barcelona's potent attack along with Messi and Luis Suarez, Neymar helped the team win nine titles: two Spanish league titles, two Copa del Reys, two Spanish Super Cups, the Champions League, the European Super Cup, and the Club World Cup.
The trio of attacking players scored 122 goals in the 2014-15 season and 131 goals last season, both record figures.
Neymar now has the longest contract among the team's top players. The contracts of Messi and Andres Iniesta end in 2018, while Suarez has a deal until 2019.
Neymar and his father, who acts as his agent, are likely to face trial for fraud in Spain in a case into alleged irregularities regarding his transfer from Santos to Barcelona. A Brazilian investment group which was entitled to 40 percent of the transfer claims it received a smaller compensation than it should have because part of the fee was concealed.
Barcelona also confirmed that defender Javier Mascherano will be staying with the club until 2019. That deal also had been announced in July.
Tales Azzoni on Twitter: https://twitter.com/tazzoni. His work can be found at http://bigstory.ap.org/content/tales-azzoni