The race was won by Jorge Lorenzo.
Rossi was on fire from the start of the 27-lap race moving from fifth to overtake fourth-placed Pol Espargarò.
Though the gap to Marquez initially increased, Rossi started to get closer to Marquez with 15-laps remaining.
But due to front tyre wear he was unable to get close enough to overtake in the latter stages of the race and had to settle for a third podium finish of the season and the 200th podium finish of his career.
Rossi told media afterwards that the team struggled over the weekend but were happy to have got a podium finish.
"It was a difficult weekend. From Friday on we were struggling a lot to find the right setting and I wasn't able to ride on the maximum level.
"In the end it's a podium, so it's not so bad, but also in the race I wasn't strong enough to fight with Jorge and also with Marc. Especially entering the corners I wasn't at 100%. I had one moment in the race where I was not doing so bad and I was close to Marc. We hoped for another good fight until the end and I thought I could do it, because I got the gap down to one second, but had to give up," said Rossi.
"I have scored a lot of points and scored two victories and four podiums. This time I extended my lead to Dovizioso, but it looks like Jorge also came back into the championship with this victory.
"He is just 20 points behind, but the championship is still long. We don't have to think about the points yet, just of the bike, trying to be competitive every weekend," he added.