Cavendish won the 155.8km ride from Epsom to Guildford in a time of 3 hours 46.57 seconds to register his second stage victory of the race.
The Omega Pharma-Quick Step rider sprinted from deep, holding off a late challenge from Italian rider Ella Viviani, who finished second, and Germany's Gerald Ciolek in third.
Cavendish admitted to mistiming his attack due to over-confidence.
"We planned to kick with 700m to go but I am just lucky that I have that second kick," he told reporters. "The guys did a brilliant job and I am so happy."
Team Sky's Wiggins crossed the line with the rest of the peleton and leads the general classification by 26 seconds from Team IAM Cycling's Martin Elmiger.
Britain academy rider Simon Yates is third heading into Sunday's final stage in central London.
The 33-year-old Wiggins, last year's Tour de France champion, is aiming to become the second Briton in a row to win the race after Jonathan Tiernan-Locke won it in 2012.
Leading results from the seventh stage of the Tour of Britain, a 150.4km ride from Epsom to Guildford on Saturday:
1. Mark Cavendish (GBR) Omega Pharma Quick-Step 3hrs 46mins 57secs, 2. Elia Viviani (ITA) Cannondale Pro Cycling same time, 3. Gerald Ciolek (GER) MTN Qhubeka s.t., 4. Blaz Jarc (SLO) Team Netapp Endura s.t., 5. Jacob Rathe (USA) Garmin Sharp s.t., 6. Matteo Pelucchi (ITA) IAM Cycling s.t., 7. Chris Opie (GBR) Team UK Youth s.t., 8. Martin Elmiger (SUI) IAM Cycling s.t., 9. Alessandro Bazzana (IIA) Unitedhealthcare Pro Cycling s.t., 10. Sam Bennett (IRL) AN Post Chain Reaction s.t.
1. Bradley Wiggins (GBR) Sky Pro Cycling 27hrs 57mins 59secs, 2. Martin Elmiger (SUI) IAM Cycling at 26sec, 3. Simon Yates (GBR) Great Britain at 1min 06secs, 4. David Lopez (ESP) Sky Pro Cycling 1.08, 5. Sergio Pardilla (ESP) MTN Qhubeka 1.16