The former Southend player joined the club in 2008, and hit 18 goals to help Brentford to the League Two title before injuring his shoulder in April.
"Agreeing a new contract means I can concentrate on the job in hand," MacDonald told the club website.
"It's such a relief at this important stage of the season not to have to concern myself with discussion regarding a new contract," he added.
Bees manager, Andy Scott, continued: "He has shown that he is capable of scoring goals both at League Two and League One levels and indeed has been a mainstay of the general improvement of the squad.
"I was therefore very pleased to offer him an improved and extended contract and was equally delighted that he accepted the terms offered."
Brentford currently lie 15th in League One, six points off the relegation places.
Source: BBC Sport
Source: BBC Sport