That could be a few different things, not just related to lack of fuel.
It could also be related to lack of pressure in the pistons which can be due to a few different things, like engine head cracked, burned head gasket or even the piston rings gone bad.
But none of these is a common thing, unless your engine temperature reaches extremely high levels due to lack of coolant for example, but again this is a not a common thing.
The common thing when this occurs all of a sudden is an injectors fault or fuel pump gone bad which could be caused by an old fuel filter and dirty fuel used, or just wore out.
The price for a fix could vary from a simple gasket $5 value up to a few hundreds in case you need to replace your fuel pump or an injector.
I forgot to add that this could also be a simple sensor fault, which is easily replaced usually and can vary roughly $70-$150 on a car, or even the spark plugs, 1 of them not working.
This post was edited by FedOx on Jul 6 2016 02:34pm