The bowls pair led throughout a one-sided final, with Malaysia getting on the scoresheet only near the end, and the match finished 20-3 for the home duo.
There was later a comfortable gold for Libby Clegg in the parasport 100m at Hampden, provoking an emotional response from the home crowd for her, and a rendition of Flower of Scotland for the podium ceremony at the national stadium.
The 22-year-old and guide Mikail Huggins, who together won silver at London 2012, crossed the line in 12.20 seconds to emphatically claim the title.
They were out of the blocks far quicker than the three opponents and pulled away to win by more than a second to the delight of a raucous full house.
Shooter Jennifer McIntosh won bronze in the 50m prone finals at Barry Buddon near Carnoustie.
Their victories mean Team Scotland now have 33 medals in all, including 13 golds, a new all time high, eclipsing the previous gold record set in Melbourne in 2006, and equalling the previous record of Edinburgh in 1986.
The bowls triumph at Kelvingrove was Marshall's third Commonwealth title after pairs victories in 2002 and 2006 but he said winning in front of a home crowd was his biggest achievement to date.
Marshall, from East Lothian, said: "This is just fantastic. I have won two golds before but this one tops the lot. Playing in your own back yard, in front of your own fans - you just can't beat it. Simply the best.
"It's definitely one of the highlights of my career. That is our 12th gold medal of the games for Team Scotland, so that is another record broken, which is fantastic.
"We got off to a good start. Paul was phenomenal from start to finish and that makes my job a lot easier.
"But even so, there was still a lot of pressure on us. We just had to keep going and that's what we did."
Foster, who won a Commonwealth pairs gold in Melbourne eight years ago, feared his chances of landing a second had been ruined just a fortnight before the game when his prize bowls were stolen.
However, they were soon returned to the Troon taxi driver and he lapped up his latest triumph, saying: "I didn't think anything would beat 2006 but this tops everything. To win a gold on home soil is a feeling that will live with me forever."
Cabinet Secretary for Commonwealth Games, Shona Robison said: "What a fantastic day for Team Scotland, with just under a week of competition left, Scotland has won its highest ever number of gold medals.
"Five days in, Glasgow 2014 has produced some inspirational sporting moments, including exceptional performances in the pool from Hannah Miley, Ross Murdoch and an unforgettable performance from Erraid Davies, Team Scotland's youngest ever athlete.
"Team Scotland's performance in judo has also been outstanding, resulting in its most successful Commonwealth Games ever with a total of 13 medals.
"I'm proud of all our athletes, their hard work and dedication is an inspiration to us all. The support from the crowd has also been fantastic not only for our own sporting heroes but to all those competing throughout the Commonwealth.
"Team Scotland are well on track to achieving our highest ever medals, with yet more medal chances over the coming days. I wish all our athletes the very best of luck. Go Team Scotland."