Yates was part of a reduced peloton on the final climb of La Planche des Belles Filles and put in a strong attack after eventual stage winner Fabio Aru had taken flight.
Yates would pay for the acceleration on the final slopes of the climb and was unable to follow when Chris Froome (Team Sky) countered with several other GC rivals.
Yates put 14 seconds into fellow white jersey contender Louis Meintjes (UAE Team Emirates) and further time into Pierre Latour (AG2R La Mondiale) and Emanuel Buchmann (Bora-Hansgrohe). Yates now leads Latour by 24 seconds with Meintjes and Buchmann 41 and 46 seconds down, respectively.
"That's what I'm here for but there are a lot of strong guys competing for the white jersey this year. We'll see, I'll fight for it," he told Cyclingnews.
Up until stage 5, Yates had endured a mixed Tour. He put in a smart performance during the opening 14-kilometre time through the German city of Dusseldorf but lost ground on the uphill finish in Longwy on stage 3. After Wednesday's action, he sits sixth overall, 43 seconds off new race leader, Chris Froome.
"I felt much better today than on the other stages. I don't know what it was the other day, I just didn't have the legs. Hopefully, I'll have more days like this."
Yates' attack was snuffed out by Geraint Thomas, who was riding in the services of Froome, despite holding the maillot jaune at the start of the stage.
"I wanted to win the stage," Yates said.
"I felt good there on the final climb and looking back now I should have stayed in the wheels. I burnt some biscuits there for the final but like I said, I wanted to win the stage, and sometimes you have to take some risks. I've had some up and down days, like two days ago when I lost some time. I didn't really have it in the legs that day."
Yates' acceleration on La Planche des Belles Filles was the only one to come from the white jersey contenders but it also laid out the British climber's intent on winning a stage and finishing inside the top ten this year. Consistency will be key, but Yates is not afraid to take risks on the climbs either.
"Fabio is really strong, Richie Porte is really strong and they're all strong. I'm not really a big fan of the heat so just to be with the best guys there I was pretty happy, I felt good but I paid for it in the very final bit.
"I felt good and tried to go for the stage and tried to attack and go after Fabio there. I knew it was steep at the finish there, but I just wanted to try for the stage."