The American pair pulled clear on a previously crowded leaderboard on the back nine but it was the 2017 US PGA champion who triumphed with a five-under-par final round of 65 in Memphis.
That left him 13 under, three clear of the field for his third win of the season as four-time major winner Koepka double-bogeyed the last.
England’s Tom Lewis came up just short in his charge for a remarkable victory.
Maintaining the momentum after his stunning course record-equalling 61 at TPC Southwind on Saturday, the 29-year-old from Welwyn Garden City picked up five birdies on the front nine and at one point was in a five-way tie for the lead before twice dropping shots as Thomas and Koepka pulled clear.
Lewis, who opened his tournament with a three-over-par 73, began the day six strokes behind overnight leader Brendon Todd in a share of 10th place.
Yet while Todd started slowly with a run of seven pars before bogeying the eighth, Lewis powered on with four consecutive birdies from the third and another at the ninth.
Thomas, who had been four strokes back in fifth overnight, made his move with four birdies on the front nine to climb to 12 under and overtake Todd.
Koepka, who will bid to win a third successive US PGA Championship next week, kept himself firmly in the picture with birdies at the first and ninth and was 11 under after nine.
He briefly hit the front with a birdie at 13 after Thomas bogeyed 12, but made a costly bogey at 16 as Thomas produced back-to-back birdies.
Koepka’s superb birdie putt at the 17th set up a chance of a dramatic finish but he found water off the final tee, allowing Thomas to close out victory with a par.
Phil Mickelson and Daniel Berger were also in the group at 10 under, while Open champion Shane Lowry and Englishman Matt Fitzpatrick finished a further shot back in a six-way tie for sixth.
South Korea’s Byeong-Hun An and American Rickie Fowler, second and third after Saturday’s play, fell back to eight and seven under respectively.
World number one Jon Rahm was well out of contention but carded a final-round 66 to move to one over. Tommy Fleetwood finished with a 65, his best round of the week, to finish under par on minus three.