The space station had been falling back towards Earth and losing power before Atlantis docked with it last Sunday.
The seven astronauts have now sealed up the station in preparation for their departure later on Friday; they should return to Earth late on Sunday night at the Kennedy Space Center in Florida.
Without the American mission, the $60bn international space station could not have been made fully habitable for the first permanent crew, which is due to arrive in November.
False alarm
One of the astronauts due to return to the station next year, the American Susan Helms, expressed satisfaction with the team's achievements.
"Obviously I have a vested interest in what's going on up here, and I can't be happier with how things have gone. The repair work has been very smooth and quick," she said.
On Wednesday, Mission Control in Houston said it might be necessary to extend the mission by a day because of a fault found in one of the four batteries the crew have just installed in the station.
But Nasa engineers later said the trouble - irregular readings while the battery was being charged - appeared to be due to bad communication, a problem on Earth.
Sinking
The main task for the crew - six Americans plus the Russian cosmonaut, Yuri Usachev - was to boost the space station into a higher orbit.
It had sunk as low as 325 km (202 miles) because of increased solar activity, which causes the atmosphere to expand and spacecraft to sink.
But the astronauts have also fixed a wobbly construction crane, replaced a broken communications antenna, installed four new cooling fans and 10 new smoke detectors, and hauled huge quantities of equipment on board.
International co-operation
The station, being built in space by the United States, Russia, Canada, Europe and Japan, currently consists of a Russian module, Zarya, and a US module, Unity.
In July a third component, the Russian service module, Zvezda, is due to join them, bringing the living quarters and life support needed to make the outpost fully habitable.
Work to finish the giant space laboratory will require some 40 space missions between now and 2005.
It will eventually house six and seven-member crews who will rotate after stays of about five months each.