Pettitte (4-2) broke a personal three-start winless streak, holding the Royals to two runs on five hits. The veteran left-hander walked one and struck out seven.
Wells' long ball with Chris Stewart aboard in the fifth inning erased a 2-1 New York deficit.
The loss was hung on Royals starter James Shields (2-3), who gave up three runs (two earned) on six hits over eight frames.
Billy Butler belted a solo homer for Kansas City.