I was on a long haul flight with a friend, I’m step climbing from FL310 to FL370 while he was just gonna cruise at FL310.
I realised after my first step climb from FL310 to FL330 that my friend who was 20nm behind me started getting closing while we both were cruising at M.84 and by some time he was 20 nm in front of me
I thought that the higher airplanes climb, the thinner the air gets, and the more efficiently they can fly because of less resistance in the atmosphere meaning they fly faster reaching their destination much quicker.
I thought that was the whole point of step climbing (also saving fuel aka less consumption)
Of course!!! Welcome to the wonderfull world of winds aloft! I only know how to do it for the US but I am sure there are charts of winds on simbrief or something. I must warn you, government websites look like they were created by 2 year olds.
Just click on the region and look for the IATA of the airport you want. The altitude is at the top and the winds are shown as a four digit number. The first two are the direction and the last two are the speed. So 3611 means winds from 360 at 11 knots
Along with tailwinds or headwinds, like others commented, another contributor is the thinner air like you said. It produces less drag on an airplane, allowing for more efficient movement of the plane thru the air. The reduced air density also helps since lift depends on air density and less density means that the wings have to produce less lift in order to support the plane’s weight. Another part of it is that turbulence is often cause by mountains and buildings so when the plane flies above those you get less turbulence and also faster flight.