It was a hard-fought race for all three.
Marquez was on pole, but Lorenzo took the lead after starting from fourth place. He in turn was overtaken by Pedrosa, who started from fifth, in lap 5.
This sparked a thrilling battle between Lorenzo and Marquez for second place. The 20-year-old, who Lorenzo knocked once, eventually gained the upper hand with 11 laps in the 20-lap race to go.
Lorenzo's teammate, seven-time world champion Valentino Rossi of Italy, finished fourth after starting from second place.
He was followed by Spanish Honda rider Alvaro Bautista, while British Yamaha rider Cal Crutchlow, who started third, fell back to sixth.
"It was a nice battle with Jorge. I enjoyed it a lot," Marquez said.
"I tried to reduce that gap (to race leader Pedrosa) but I saw that it was too much risk, and the target of this weekend was to finish in front of Jorge," he said, adding that extending his championship lead was "most important".
"I prefer to take that 20 points (for a second place finish). I think about the world championship too."
With three races remaining, Marquez tops the standings with 298 points, followed by Lorenzo at 255 points and Pedrosa at 244 points.
Lorenzo conceded he would aim to retain the season's second place with the Hondas outperforming the Yamahas, especially in warm weather.
"It was a great battle (with Marquez)... He was strong. He didn't lose the concentration. He deserved the second place," the title defender said.
"We hope in Phillip Island (in Australia) with colder temperatures and a more flowing track without so much braking, we can fight for the win and also to keep the second place in the championship because the first one seems more difficult now," he said.
-AAP