I don't know which engine you have but this is typical of a failing crankshaft position sensor or camshaft position sensor. You'd have to catch it while the problem is occurring, and check for loss of spark. Also read and record the diagnostic fault codes. The people at many auto parts stores will do that for you for free.
SPONSORED LINKS
Tuesday, March 7th, 2017 AT 9:12 AM