losing power on 2003 Ford F-250 Super Duty

i was driving my truck today and i lost power and all my gauges went all the way up and then all the way seemed like it as gonna stall but didnt then it drove normal and did the same thing again a fe miles down the road...any help?

Asked by for the 2003 Ford F-250 Super Duty
i would start with the battery cables, connections and grounds. did the check engine light come on??