The 32-year-old attacker has followed in the footsteps of Billy Sharp and Oliver Norwood in signing a new deal at Brammall Lane ahead of the resumption of Premier League football next week.
"There's nowhere else I'd rather be spending the next two years, so I'm over the moon to sign this extension and remain a part of this fantastic journey the club is on," said McGoldrick, who will now remain a Blade until 2022.
"As everyone has seen, this is a club that rewards and ties down those players that have contributed heavily to the success it's enjoyed so I'm delighted the gaffer sees me in the same bracket as Billy, Ollie and before that Enda and Flecky.
I'd like to thank the gaffer [Chris Wilder] and the board for getting this sorted so quickly and smoothly.
"This is a strange and horrible time for everyone, in all walks of life, and it's been tough. But the good news is coming back out of the club and I'm really pleased to have committed my future.
"It all starts again at Villa and that will be a tough first game back. It's going to be different to normal in a lot of respects, but we believe we're 100 per cent ready and as we've proved on numerous occasions that we're a match for anyone."
McGoldrick joined United on a free transfer in the summer of 2018 and went on to score 15 times as the Blades were promoted from the Championship.
This term he has featured on 21 occasions in the Premier League, but remains without a goal.