The 14th-ranked Bulls committed 14 penalties for 109 yards, including a defensive holding on a missed field goal by Louisville that would have given USF (6-2, 1-2 Big East) the ball back late in the fourth quarter.
South Florida's Matt Grothe threw for 344 yards and two touchdowns, but he also was picked off twice. His fourth-quarter interception gave the Cardinals the ball at USF 27 and allowed the Cardinals (5-2, 1-1) to run out the clock.
Cantwell threw for 212 yards and ran in Louisville's other touchdown from the 1.
With Pittsburgh losing to Rutgers on Saturday and UConn knocking off Cincinnati, the Big East race is muddled behind first-place West Virginia. The Cardinals have bounced back well following a disappointing first season under coach Steve Kragthorpe and are in the thick of the chase.
The Bulls had been averaging 195 rushing yards per game, but the Cardinals held them to 8. Linebacker Jon Dempsey, the Cardinals' leading tackler, had nine tackles and a sack. Defensive linemen Earl Heyman and Adrian Grady sacked Grothe twice each.
The Cardinals contained Grothe's running but when Louisville's pass rushers didn't pressure him, he had an easy time making completions. He was 30-for-30 for 344 yards.
The Bulls struck first with a 32-yard field goal by Maikon Bonani in the second quarter but the Cardinals hit back with Cantwell's first touchdown to Long, a 69-yarder that was a career long for both players, and Long's first career touchdown catch.
Cantwell ran the ball in for Louisville's second touchdown of the quarter with less than a minute to go before halftime.
The Bulls drove 63 yards in 48 seconds but had to settle for another Bonani field goal from 24 yards with 2 seconds left in the half that made it 14-6.
Grothe threw a 3-yard touchdown pass to Richard Kelly late in the third quarter to make it 14-13 and his 15-yarder to Ben Busbee with 9:22 left in the fourth quarter gave USF a 24-20 lead.
The home team has won five straight games in the series.