It could also be dirt/loose rust in the fuel tank. The car will start and run fine initially, but as the petrol is sucked out of the tank into the fuel pipe through a small gauze strainer, the loose debris in the tank gets pullled up around the filter, eventually blocking it and thus cutting off the fuel supply. The engine then stops, and eventuially the pressure in the fuel pipe falls, allowing some of the debris in the fuel tank to fall away from the gauze filter. This then allowws a little bit of petrol though to the engine. The car will then restart, but doesn't run far before losing power and conking out.
To immediately cure the problem you have to disconnect the fuel pipe between the tank and the fuel pump, at the fuel pump, and blow down it. This pushes away the debris from the filter, but only temporarily. However if this gets the car running for longer, you then know that this is your problem. Then you will have to take the fuel tank off and rinse it out.
I spent ages trying to work out why my old loading shovel keeps stopping due to fuel starvation. And we always ended up blowing down the fuel pipe to listen for the bubbles in the tank, just to make sure it hadn't run out of diesel. And it always starts afterwards. So I am going to try and clean it out with a magnet, either on the end of a telecope, or on a rod and a piece of string, before I attempt to remove it.