To start with, please click on the PROFILE link at the top of the page and put your year and model in your signature (and tell us here what it is).
So it starts to sputter and stutter, you try to save it with a little gas, and it sometimes saves itself?
If this is correct, you either have a vacuum leak or poor fuel pressure. If you're familiar enough with your engine, you can spray carb cleaner lightly on each vacuum fitting under the hood at idle, and listen for the idle to change. Don't forget to do the same to the EGR valve.
How old is your fuel filter? Do you have any way of testing your fuel pressure? What year and engine/model do you have?