Johnson finished third at Phoenix International Raceway to widen his lead in the Sprint Cup standings to a sizable 28 points over Matt Kenseth, who finished 23rd, with only one race left.
The season finale, and the last of the 10 races in NASCAR's Chase for the Cup playoff, is next Sunday at Homestead-Miami Speedway in Florida.
Johnson kept his No. 48 Chevrolet among the leaders for most of the AdvoCare 500 despite two close calls that nearly sent him spinning out of control.
But Kenseth's No. 20 Toyota was ill-handling from the start. Combined with a botched pit stop later in the race, Kenseth kept losing more ground to Johnson, who entered the race with a seven-point lead.
The most points a driver can earn in a single race is 48. Johnson needs to finish only 23rd or better at Homestead-Miami to win the title, or 24th if he leads one lap or 25th if he leads the most laps.
Johnson, 38, won his five NASCAR titles in consecutive years from 2006 through 2010. Now he's on the verge of joining only two other drivers to win six titles: Richard Petty and the late Dale Earnhardt Jr., who each won seven.
"We're heading into Homestead in the position we want to be in," Johnson said, but added that "it's far from over. You've got to finish that race."
Kenseth, who drives for Joe Gibbs Racing, called it "an unfortunate, disappointing day. We just were off. We still got a race next weekend and we're going to try to win that."
Harvick's No. 29 Chevy was strong all day — he led a race-high 70 of the 312 laps — and his four wins at Phoenix tie Johnson for the most victories at the one-mile oval.
But he seemed destined to finish second behind Edwards until the cars came to the white flag signaling one lap to go.
At that point Edwards' No. 99 Ford ran out of gas and Harvick and much of the field shot past him.
"We just miscalculated," Edwards, who finished 21st, said of his Roush Fenway Racing team. "I thought we were a lap to the good. I was saving just a little bit of fuel, but obviously not enough."
Harvick isn't out of the Chase either, although his 34-point deficit makes him a longshot.
Johnson twice narrowly escaped major problems that could have hurt his title hopes. On the opening lap, his car was tapped by Joey Logano's Ford and Johnson briefly lost several positions.
Bumped again on Lap 162 by Edwards, Johnson made a superb save to avoid slamming into the outside fence.
"As I saved it, the car pointed back at the fence and I thought I was going to hit it," Johnson said. "Thankful that didn't happen."