It was the sixth gold medal of his Olympic career and came on the final day of track cycling at the Games. Riders from Britain won seven of a possible 10 gold medals at the velodrome.
Laura Trott added a victory in the women's omnium for the host country while Australian Anna Meares denied Britain another gold when she defeated Victoria Pendleton in the finals of the women's sprint.
Hoy touched off the largest cheers, however, when he edged Germany's Maximilian Levy in the Keirin, a race in which the riders are paced around the track by a motorcycle until the closing laps.
It is then a wild scramble to the finish and Hoy, 36, won the event for the second straight Olympics. He also won a team sprint gold in London after victories in the individual sprint, team sprint and Keirin in Beijing and the 1-kilometer time trial in Athens.
He also competed at the Sydney Olympics in 2000, earning a silver medal in the team sprint.
Those six gold medals give him one more than British rower Steve Redgrave won during his career.
"This is what I always wanted," Hoy said. "I wanted to win gold in front of my home crowd.
"This is the perfect end to my Olympic career. I look back four Games ago to Sydney and I was just over the moon to have a silver medal.
"'If I had stopped then I'd have been a happy boy but to have gone to Athens, Beijing and to here, I can't put into words what it means."
Trott became the first winner of the women's omnium, an event that requires the cyclist to compete in six types of racing over two days.
American Sarah Hammer had a 2-point lead over Trott going into the last of those races, the time trial. Trott won the race and Hammer finished fourth, leaving the American 1 point behind and having to settle for the silver medal.
Celebrity Families of 2014 [PHOTOS]