It depends whether your car has a carburettor or has an injection system. It could be a lot of things depending on what car it is CC etc.. It could be a carb problem.
Otherwise i had similar trouble on my Renault 5 and found out that the black (negative cable) was not attached to the engine properly and when the cable heated the car jsut stopped. It's a big black cable running from your car battery on your body anf then earthed somewhere.
NickUK, June 2005