Kahne was a contender in the late stages of the race and was the first of the frontrunners to make his last pitstop for a splash of fuel and new right-side tyres, emerging in the lead once the final stops cycled under green.
Edwards cut the gap to Kahne after completing his final stop but he ran out of laps to really challenge him for the lead. Behind them Stewart passed Jeff Burton on the penultimate lap to finish a distant third and remain in close title contention.
Kahne's win, the second for Red Bull Racing Team, comes with the team's future still uncertain and in the 31-year-old's penultimate race for Red Bull before joining Hendrick Motorsports.
"It's been a long time," said Kahne. "This whole Red Bull team has done an unbelievable job to keep working hard. Kenny Francis [crew chief] keeps on it, everybody at Red Bull, the car, the Toyota engine. It was a great run today. The guys did an awesome job.
"We fell back a little bit early and then came back and just kept getting it better. These guys haven't given up in the last three months. It's been really cool."
Edwards' second place allows him to stay in control of the Chase entering the season finale, although Stewart leading the most laps means the three-point gap that separated them entering Sunday's race remains in place for the season finale next week.
The Chase leader was up front for only 27 laps but was probably the most consistent of the frontrunners throughout the race, only getting beaten by Kahne through strategy.
"We have never gone into Homestead with the points lead," Edwards said. "You know they give a boat away if you win that thing. I saw that boat and I would like to go down there and win it.
"That would be fun to put a cap on this season. That is what our mission is."
Stewart led more than half the distance and was able to beat Edwards on the outside groove during the sixth restart, then kept his Roush Fenway rival behind until the penultimate round of pitstops.
However he lost his edge after dropping to third behind Penske's Kurt Busch and Richard Childress Racing's Paul Menard, who gambled on taking two new tyres to Stewart's four at their penultimate stops.
The Stewart Hass driver was unable to remain in close contention after that, losing third to Edwards on the restart and then dropping behind Kahne as well. He was unable to recover much ground on the leaders as the race carried on under green for the last 88 laps.
"I'm just thinking of the three points," said Stewart, who would need a victory at Homestead to win his third title regardless of where Edwards finishes.
"No, we had an awesome day. We came up two spots shy. I don't know how you could have asked for a better day really. We led the most laps, we were on the same pace we were last week just to have a perfect day.
"Just fought as hard as we could all day. Got out of balance the second to last stop and just lost that little bit that we needed to stay up there and keep Carl honest."
Kurt Busch lost any chance of victory when he ran out of fuel right before his final stop, which then took longer than planned as he struggled to get his engine fired up again.
Early race leader Matt Kenseth was once again on the receiving end of a touch from Red Bull's Brian Vickers following their exchange at Martinsville two weeks ago. Vickers drove into the back of the Roush driver entering Turn 3 as Kenseth had slowed down with brake issues.
"Obviously it is retaliation for retaliation I guess," said Kenseth. "I was out of brakes and I was up on everybody and I saw him coming and I lifted at least 10 car lengths before where I would normally lift and he drove in there at 165mph and cleaned us out."
Kyle Busch made a great recovery from the back of the grid up to third but then was forced to retire with his second engine failure of the weekend, having lost a first engine at the start of the first practice session n Friday.
Outgoing champion Jimmie Johnson finished 14th and lost any mathematical chance of defending his title for the fifth consecutive time.
Kevin Harvick struggled to a 19th-place finish, never showing the speed to contend for a strong result. He leaves Phoenix third in the points but 51 behind Edwards, which means it will be a two-horse race for the 2011 Cup title at Homestead.
Results - 312 laps: Pos Driver Team/Car Time/Gap 1. Kasey Kahne Red Bull Toyota 2h45m47.000s 2. Carl Edwards Roush Fenway Ford + 0.802s 3. Tony Stewart Stewart Haas Chevrolet + 4.319s 4. Jeff Burton Childress Chevrolet + 4.634s 5. Ryan Newman Stewart Haas Chevrolet + 5.865s 6. AJ Allmendinger Petty Ford + 7.297s 7. David Reutimann Waltrip Toyota + 7.609s 8. Marcos Ambrose Petty Ford + 9.198s 9. Paul Menard Childress Chevrolet + 14.865s 10. Clint Bowyer Childress Chevrolet + 16.740s 11. Joey Logano Gibbs Toyota + 21.251s 12. Denny Hamlin Gibbs Toyota + 23.409s 13. Greg Biffle Roush Fenway Ford + 1 lap 14. Jimmie Johnson Hendrick Chevrolet + 1 lap 15. Juan Pablo Montoya Earnhardt Ganassi Chevrolet + 1 lap 16. Mark Martin Hendrick Chevrolet + 1 lap 17. Jamie McMurray Earnhardt Ganassi Chevrolet + 1 lap 18. Brad Keselowski Penske Dodge + 1 lap 19. Kevin Harvick Childress Chevrolet + 1 lap 20. Martin Truex Jr Waltrip Toyota + 1 lap 21. Bobby Labonte JTG Daugherty Toyota + 1 lap 22. Kurt Busch Penske Dodge + 1 lap 23. Brian Vickers Red Bull Toyota + 1 lap 24. Dale Earnhardt Jr Hendrick Chevrolet + 2 laps 25. Cole Whitt Red Bull Toyota + 2 laps 26. Casey Mears Germain Toyota + 3 laps 27. Dave Blaney Baldwin Chevrolet + 3 laps 28. JJ Yeley Front Row Ford + 3 laps 29. Landon Cassill Phoenix Chevrolet + 3 laps 30. Mike Bliss FAS Lane Ford + 4 laps 31. David Gilliland Front Row Ford + 5 laps 32. Jeff Gordon Hendrick Chevrolet + 6 laps 33. David Ragan Roush Fenway Ford + 14 laps Retirements: Matt Kenseth Roush Fenway Ford 238 laps Robby Gordon Gordon Dodge 218 laps Kyle Busch Gibbs Toyota 188 laps Geoffrey Bodine Baldwin Chevrolet 153 laps Regan Smith Furniture Row Chevrolet 62 laps Scott Speed Whitney Ford 60 laps Michael McDowell HP Toyota 46 laps Joe Nemechek NEMCO Toyota 30 laps Mike Skinner Max Q Ford 25 laps Travis Kvapil Front Row Ford 20 laps