RIO DE JANEIRO — Three wins from gold, and still no reason to think it will be easy for the U.S. men’s basketball team.

This is a bumpy road in Rio, but at least the Americans know Klay Thompson is finally along for the ride.

Thompson ended an Olympic-long slump with 7 3-pointers and 30 points, and the Americans needed almost all of them to hold off France 100-97 on Sunday.

The U.S. won its 50th straight tournament game, but the last three have been nothing like most of the previous 47.

“We’ve obviously had three close games in a row by our standards,” forward Kevin Durant said. “A win is a win. We’ve got to think about how we can be better but we can’t be satisfied.”

Winning by three for the second consecutive game, the U.S. improved to 5-0 and clinched first place in Group A. The Americans open quarterfinal play Wednesday, still the favorite but looking as beatable as ever under Mike Krzyzewski.

Their opponents won’t be determined until the completion of play today in the log-jammed Group B, where all six teams are still alive. The U.S. will play whichever team finishes fourth.

“This isn’t a tournament that we’re going to just dominate,” U.S. guard Paul George said. “There’s talent around this world and they’re showcasing it. For us, it’s just figuring out how we’re going to win. We’re having spurts of dominating, but we’re just not finding ways to put a full 40 minutes together.”

Nando de Colo and Thomas Heurtel each scored 18 points, carrying France while Tony Parker sat with a toe injury. Every time the Americans built a big lead, the fifth-ranked French chipped away.

“You can’t panic against this team,” France forward Nicolas Batum said. “We’ve been together for a while. We’ve been in those games down 15 and have to find a way to come back. We’ve got guys experienced, Boris (Diaw) and Tony, myself and De Colo have been with this team for 8-10 years, too.”

Durant scored 17 points after he took just four shots in the 94-91 victory over Serbia on Friday.

The Americans could never put away the French in this one, even with Thompson having his first good performance in Rio de Janeiro.

Banished to the bench earlier in the tournament, he rejoined the starting lineup Sunday and came out firing — and this time, making. He entered with just 11 points on 4-for-26 shooting in the first four games.

He hit five 3-pointers in the third quarter alone, the last making the lead seem safe at 78-62. But the French were back within four by midway through the fourth before Kyrie Irving threw a falling-down lob pass that Durant slammed down on the fast break.

“We were up 16 with two minutes left in the third and that was our time to put the game away,” Thompson said. “We have to learn from it. You can’t let up against an explosive team like France.”

Luckily for the Americans, this time they could count on offense from Thompson to get them through.

“It felt good to see the ball go in, I’m not going to lie, but it felt better to get the win,” Thompson said. “I don’t care if I shoot 10 percent the rest of the tournament, if we win the gold medal that’s all that really matters. But it’s something I can build off and it helps.”