Rattling noise in engine

My name is Melody. I have a 2000 Ford Ranger with 114000 miles. Some times when accelerate or I am going up an incline it sounds like my valves are rattling. At first I thought it could be bad gas so I had a fuel induction done and switched to better gas but it still has a rattle. I also have almost no power going up inclines. My husband and I went to Tennessee last month and I thought we weren?t going to make it because my truck could only go about 45 up a few steep inclines. Is it time for a new engine?

Melody, peruse this: http://www.aa1car.com/library/spark_knock.htm

The OP is surely describing spark knock, and just as surely, this is slowly destroying the valves and possibly the pistons.

As the link suggests, the EGR needs to be checked for proper operation.
The spark plugs may be in need of changing.

The cooling system may have a problem, ranging from low coolant, to a stuck thermostat, to a failing water pump, and any cooling problem which allows the engine to run too hot will likely trigger this spark knock.

If the engine has not been maintained well, there could be a build-up of carbon in the cylinders, and this would be a definite cause of spark knock.

In the short-term, switching to high octane (premium) gasoline may help, but this is just a band-aid, and the real cause of the spark knock needs to be diagnosed.

How has this truck been maintained over its 9 years?
If it has not been maintained well, the current condition is the likely result.
Get it fixed before more engine damage takes place.

Thank you for the info. I get regular oil changes and have kept up with the regular maintenance. I’ll try to find a trust worthy repair shop and take her in.