Have a Car Question? Ask a Mechanic Online.
From the sounds of it, you have a bad cam or crank sensor. You should go to a shop that can read sensor output signals. This not only scans for trouble codes but it all check your sensor's operation. Due to the fact that it does not happen all the time it could be that the sensor is board line, however if you run a test on the sensor they should be able to pick up which one is going out.