The 21-year-old left-handed opener played in all three formats for the club in 2015, finishing as second-highest run-scorer in the One-Day Cup.
"His performances in 2015 merit the extension," managing director of cricket Angus Fraser said.
"But for an unfortunate injury, he would have played a near full season."
Gubbins, who joined the north London club's youth system aged 14, scored 354 runs at an average of 27.23 in his seven County Championship appearances this year.
He also hit 339 runs at 56.50 in the One-Day Cup, including a score of 141 against Sussex, and scored 121 runs in the T20 Blast.
Fraser said the Richmond-born player had "showed the ability to thrive" in all forms of the game.
"We believe Nick is an exciting talent and we know he has an excellent work ethic," he added.
"The two qualities give him a great chance of having a long and distinguished career in cricket."
Middlesex batsman Nick Gubbins has extended his contract with the club and will now remain at Lord's until the end of the 2018 season.