Johnson went on to win his first career Cup road-course race and ended a 10-week victory drought for the four-time defending series champion.
Ambrose, who led 35 laps, had to settle for sixth after coughing up yet another chance at a victory.
"My bad," the Australian said. "Just feel really disappointed. Might not like the call, but it is what it is. I know the rule. It's a judgment call."
Ambrose, a road-racing ace, was cruising to a long-awaited victory when caution for a Brad Keselowski spin threw a roadblock in his path. Instructed by his crew chief to conserve fuel, Ambrose flipped his engine on and off as he circled the winding 1.99-mile course.
But his Toyota apparently stalled, and six cars weaved around his unmoving Toyota. Although Ambrose got his car restarted and moved back to the front of the field, NASCAR ordered him back to seventh for "failing to maintain reasonable speed" right before the restart.
That gave Johnson the lead and he sailed away for his fourth win of the season, but first since Bristol in March.
Ambrose crew chief Frank Kerr visited NASCAR officials after the race, and said he understood the ruling. But asked if he was "content" with the ruling, he said only "no comment."
Kerr also asked Sprint Cup Series director John Darby about the 2007 race at Kansas, where winner Greg Biffle appeared to run out of gas under caution on the final lap and was passed by Johnson and Clint Bowyer before the finish line.
"I asked John about that, and that's OK. And then I asked if it's OK to get pushed around, so I'm not really sure what the difference is," Kerr said. "Depends on who you are, I guess."
Darby said the Biffle situation was different because Biffle's car continued moving and the two cars behind him sped up to make the pass.
"Biffle maintained pace, the other cars picked up 20 miles per hour," Darby said.
Robby Gordon finished second in a Toyota for his highest finish of the season, and series points leader Kevin Harvick was third in a Chevrolet. Defending race winner Kasey Kahne finished fourth in a Ford and Jeff Gordon rounded out the top five.
Biffle was seventh and was followed by Boris Said, Tony Stewart and Juan Montoya.
Post Race Notes:
• Jimmie Johnson picked up his 51st Cup Series victory in his 307th race.
• Jimmie Johnson now lacks victories at just four tracks -- Chicagoland, Homestead-Miami, Michigan and Watkins Glen.
• With the victory, Jimmie Johnson moved from sixth to second in the Cup Series points. He trails Kevin Harvick by 140.
• Jimmie Johnson was the sixth different winner in the past six races at Sonoma.
• Robby Gordon (second) scored his best finish since he finished second at Watkins Glen in 2005.
• Kevin Harvick finished third, marking just his third top-10 finish in 10 Infineon races.
• Jeff Gordon (fifth) posted his fifth straight top-10 finish at Infineon. He extended a 16-race streak of running at the finish.
• Marcos Ambrose (sixth) posted his best finish in 2010 and best since third at Bristol in Aug. 2009. He has posted top-10 finishes in the past four road-course races.
• Dale Earnhardt Jr. finished 11th in what was his 375th consecutive Cup Series start, a streak that began at Atlanta (Nov. 1999); he has never scored a top-10 finish in 11 Infineon races.
• Clint Bowyer (31st) ended a three-race streak of top-10 finishes at Infineon.