If mine did that the first thing I would do is test the engine speed sensor...aka CPS. Then pull it and take a look at the pickup because these are known to get stuff thrown up onto them. If that was OK then I would check for any other electrical connector problems and fuel supply issues.