Jess Learmonth led Britain out, while Georgia Taylor-Brown and anchor leg Yee, the individual silver winners, completed the impressive all-round display.
The victory takes Britain's medal tally to eight, including three golds, since triathlon was introduced to the Olympics in 2000.
It was an emotional triumph for Jonny Brownlee, who won individual bronze and silver in 2012 and 2016 and finally bagged a gold to enable him to share bragging rights with double individual champion and big brother Alistair.
"The Olympics is complete -- it feels absolutely amazing," Brownlee said.
"My third Olympics and I can finally walk away with gold.
"The Olympics is always special but to do it as a team is absolutely amazing."
The race format features teams of two men and two women, who each complete a short-course race of 300 metres swim, 6.8km bike and 2km run that makes for fast-paced action.
Learmonth produced a lightning second transition on the first leg to open a small gap going in the run, but Britain, the U.S., Germany and the Netherlands were all together handing over.
The four teams at the head of the field remained together after the second bike leg, but Brownlee flew out of the second transition and immediately opened a gap, which he extended to nine seconds over the U.S. with a gutsy run on his last competitive appearance over the shorter distances as he plans to move up to Ironman.
Taylor-Brown swum superbly to stretch the lead to 23 seconds, with Taylor Knibb forging clear from the chase pack to leave the U.S. clear in second.
Taylor-Brown handed over to Yee, probably the fastest runner in the field with the 2018 British 10,000m track title to his name.
On the last leg, double world champion Vincent Luis overhauled Morgan Pearson on the swim then drove on strongly to catch Yee on the bike.
Two years ago Luis beat Yee in a photo finish in the Tokyo test event, but the young Briton made sure there was no repeat as he got a break in transition and poured on the power in the run to immediately open a telling gap to win by 14 seconds.
"I was pretty scared taking over, the guys had been perfect and I wanted to do it justice," Yee said.
"When Luis came past I knew I just had to get on there as my run is my strength so I had to hang on. Then I just went for it right at the start of the run to get an early gap."