This sounds like an electrical actuator or sensor at fault .Usually when you can cycle the ignition key on / off and then restart the engine and the fault is gone temporarily this indicates that this is an electrical component causing this issue.
This could be a wiring issue as things tend to expand when hot and its possible a poor or partial electrical connection is being pushed apart on one of the major sensors so check the connection plug and wiring to the following;
Crank position sensor
Cam position sensor
Throttle position sensor
Also worth checking the connections to the fuel pump for the same reason - unplug each in turn and give them a good squirt of switch / contact cleaner - Not WD40
and also unplug and inspect the main power relays and fuses for signs of overheating or corroded terminals - so the ones for the ECU and the fuel pump
And also unplug the wiring loom connections in the engine bay one at time and inspect for corroded or recessed pins.
also check the condition of the small earth connections onto the engine, these will exit the wiring loom with ring terminals that are then bolted to the engine
I was very pleased with the service.
Bear in mind that the site takes a deposit from you at the beginning and this is held by the site until you rate my answer at which point the cash is split between the site and the expert. so if my answers have been helpful please rate my answer.
If you don't rate then you can use the cash at a later date to ask another question.