The 28-year-old's existing deal was due to expire at the end of next season.
But a post on Bayern's official Twitter feed read: "Official: Rafinha (28) just extended his contract with FCB by 3 years to 2017!"
The Brazilian, who was signed from Genoa in 2011, has made 24 appearances in all competitions for Bayern this season. He featured 17 times, scoring twice, in their treble-winning 2012-13 campaign.
"It's very important for me, my career and my family that I can continue to work for one of the best clubs in the world," Rafinha told Bayern's official website. "I am very proud."
The deal was signed in Marrakech, with the Champions League title-holders away at FIFA's Club World Cup.
They will play Raja Casablanca in Saturday's final and Rafinha said: "It's a dream to play this final. We really need to play well and win."
Rafinha is the third Bayern defender to sign a new deal in the last two months, following in the footsteps of fellow full-back David Alaba and centre-back Jerome Boateng.