The Croatian midfielder has won eight trophies since joining Barcelona from Sevilla in 2014.
Rakitic, 28, started on Wednesday as Barca recovered from a 4-0 first-leg thrashing to beat the French champions 6-1 and reach the quarter-finals for a 10th consecutive season.
"Barcelona can announce they have reached an agreement with Ivan Rakitic for the renewal of his contract until June 30, 2021," Barca said in a statement.
"His release clause will be set at 125 million euros ($132.5 million)."
Rakitic has won eight trophies since joining Barcelona from Sevilla in 2014.
Among his 23 goals in 145 appearances was the opener as Barca beat Juventus 3-1 in the 2015 Champions League final.