However, Gasly's grand prix unravelled at the first corner when he made contact with both Racing Points, placing him at the back of the grid.
Ricciardo and the second Toro Rosso of Daniil Kvyat switched to a two-stop strategy late on into the race, which allowed both of them to catch up and overtake cars, making their way into the top ten.
Ricciardo says he wasn't aware of Gasly's position on the track, which made his anxious about Renault's finishing position.
"Obviously I knew at the time Nico was the only point car so I needed to get two cars. I saw them [Kvyat and Hulkenberg] battle and thought maybe I could collect both.
"Nico had a big moment out of Turn 13, I thought he was going to spin actually so we got him but I guess it was irrelevant because Carlos got the last point.
"I didn't know where Gasly was on the track but I knew Kvyat was in the points so I was actually quite nervous that they done us in the points."
Much to the relief of Ricciardo, Renault held on to fifth place and finished ahead of Toro Rosso, as the Australian brought his first year with the Enstone squad to a close.
"But they didn't [jump Renault] so I think it's a relief to get out of here but I don't want to let this go. I want to find out why the hard didnt work and why we put the hard on. It wasn't our first plan in the strategy."
Bahrain International Circuit - Winter testing
Would you like to stay up to date with the latest Lewis Hamilton and Formula 1 news from GPtoday? Activate free push notifications and be the first to know!