The 28-year-old Croatia international will sign the deal, which has a £109m (125m euros) buyout clause, on Friday.
Rakitic - whose current contract runs until 2019 - has made 145 appearances for Barca since his 2014 move from Sevilla, scoring 23 goals.
He played in Barca's famous 6-1 comeback win against Paris St-Germain in the Champions League on Wednesday.
Barcelona midfielder Ivan Rakitic has agreed a new contract, tying him to the Spanish champions until 2021.