Engine Dies on Highway

So I'm driving on the higway cruising when I feel a loss of power in my car in other words I'm giving it gas but it kept on dying out . I pull over to the side and try to start up the car which it will bit it wont stay on, I get towed home on a bed and try starting up the car and it cranks right up and the next day same thing car will start stay on for a few minutes then same thing. I'm really puzzled as to why this is happening any help would be greatly appreciated