Pettersson shot a final round two-under-par 69 to finish the tournament at 14-under, a comfortable five shots clear of his nearest rival, former Masters champion Zach Johnson (70).
"The swing felt good," Pettersson said. "I felt calm. It was a great feeling today."
It was his first US Tour win since the 2010 Canadian Open and allowed him to match Jesper Parnevik's total for most won by a Swedish player.
Donald needed to finish eighth or better to retain his number one ranking but the Englishman tied for 37th after a final round 71 for a two-over total 286.
Northern Ireland's McIlroy will leapfrog back to the top when the updated rankings are released on Monday.
Colt Knost's chances of winning his first USTour title vanished with a 74 that put him third, one stroke behind American Johnson. Kevin Stadler (68) and Billy Mayfair (69) tied for fourth at six under par, a distant eight shots back.
Tne outcome was never in doubt after Pettersson birdied three of the first five holes on Sunday.
“Getting off to a birdie on number one was great," said the Swede, who sank a 24-foot putt at the first and thrived on the outward side throughout the tournament.
"The whole front nine I played really good."
Pettersson said a swing change he incorporated three weeks ago at the Houston Open had paid off.
"In Houston I found that new swing key, just opened up my stance and left my left hip clear through the ball," he said.
"I've played great. So hopefully this feeling lasts a long time."
The last time the portly Pettersson tinkered with his game and lifestyle it did not work out so well.
"In '08 I had a good year. I won Greensboro that year. I was trying to figure out what I was going to do to get to the next level and fitness, and I really started working out and eating better, and I lost 30 pounds very quickly," he recalled.
"That was during the off-season, and it really threw my golf game. In '09 I played terrible, I finished 150-something on the money list," the 34-year-old Pettersson said.
"It took a long time, just the last six months I felt comfortable again. Threw my timing off," he said, adding that his Canadian win in 2010 was more like catching "lightning in a bottle."
"I felt like this year my game was starting to come back to where it was. I played really solid. It's fun to play again, and I kept the weight on."
Pettersson said putting the weight back on had been easy.
"Well, you drink 10 beers and (eat) a tub of ice cream before you go to bed," he said, drawing laughs at his press conference. "That puts it on quickly."