The 30-year-old, who joined from Livingston last summer, had a year of his previous deal still to run but is now tied to McDiarmid Park until 2013.
The defender told the club's official website: "I'm delighted to have got this extension to my contract done so quickly and I can enjoy my summer break now.
"Last season worked out so much better than I ever could have imagined.
"I thought I might have to be content with being a squad player, so to get straight into the team and remain there for more or less the entire season was a real bonus."
Mackay missed only two of Saints' 45 fixtures this term and swept the board at the club's end-of-season awards thanks to his displays at both right-back and centre-half.
He added: "Last season was one of the best of my career and certainly the most enjoyable.
"The manager made me feel welcome from day one and, along with the rest of the lads, what I want to do now is try and build on what we achieved last season.
"There is no reason why a top-six finish isn't a realistic aim."