Have you checked what codes it's giving you against the Haynes manual? I think when the check engine light comes on, you turn the Jeep off, turn the key on, off, on, off, then on again and see what happens. the check engine light will flash a certain number of times, then stop, then go again, then stop then finish with a certain number of flashes. I don't have my Haynes manual handy, but it does give you a run down and some possible problems depending on what codes you're given. Then again, I don't know what kind or year of Jeep yours is, so I could be out to lunch...
I had the TPS sensor go on my '94 Cherokee and it ran fine unless I tried to aceelerate and the check engine code trick helped me figure that one out.
Just my $0.02