Problems with toyota 4runner 95 180,000 miles

i just bought this car like 3 days ago and no problems till today. I drove down the highway got off and drop someone off(still with no problems)i pull out of the drive way and the RPM gage was jumping from 1 to 2 and back down again and would not accelerate past 10 mph then i pulled over and put it into park and pushed the gas it happened again but soon was back to normal so i drove home with no problems. What could have caused this?