CAR WILL START UP AND THEN IT CUTS O

The car runs good. But, everynow and then the car wikk start up, then it cuts out. The car will start up again, then after 5 seconds or so it will cut out again. It will continue to do this, but it will not stay running.
I changed the fuel pump and the fuel filter. I thought it fixed the problem, but I was wrong. I put another computer from the salvage yard on, but the car did the same thing, start, run for about 5 seconds, then cut off. I don't know what else to try. Could it be a sensor or something?