Mr Johnson said the West must "stay the course" on Ukraine despite rising living costs, driven by the war.
He said while energy bills were high "the people of Ukraine are paying in their blood" for Russia's "evils".
Mr Johnson visited the capital Kyiv to mark Ukraine's independence day.
A close ally of Ukrainian President Volodymyr Zelensky, Mr Johnson was making his third visit to Ukraine since Russia invaded six months ago.
He claimed Western unity on Ukraine was "growing" despite reports of waning support among European countries as rising energy prices cripple the global economy.
In the UK, the inflation rate is forecast to hit a 42-year high of 13.3% this year, while the economy is expected to shrink for more than a year.
The Bank of England said the main reason for high inflation and low growth was rising energy bills, fuelled by Russia's invasion of Ukraine.
European countries have accused Russia - a major global supplier of energy - of using gas as a weapon by limiting supplies in response to sanctions.
Mr Johnson acknowledged Western countries had paid a heavy price, including the UK, where Russian President Vladimir Putin's "ruinous war" had sent energy bills skyrocketing.
"We know the coming winter will be tough and Putin will manipulate Russian energy supplies to try to torment households across Europe," Mr Johnson said. "Our first test as friends of Ukraine will be to face down and endure that pressure."
During the trip, he vowed that Ukraine "can and will win this war" against a "barbaric and illegal invader".
The prime minister also announced a further £54m military support package for Ukraine.
This includes 2,000 drones and loitering munitions which Downing Street said would help Ukraine "to better track and target invading Russian forces".
The UK is one of the leading donors of military and humanitarian aid to Ukraine, and has imposed sweeping sanctions on Russian targets prosecuting or linked to the war.
It is likely to be Mr Johnson's final visit to the country as UK prime minister, as he is due to leave office on 6 September.
Mr Johnson said the UK military aid would "give the brave and resilient Ukrainian Armed Forces another boost in capability, allowing them to continue to push back Russian forces and fight for their freedom".
He was presented with the Order of Liberty - Ukraine's highest award that can be given to foreign nationals.
And, appearing with Mr Johnson in Ukraine's capital, Mr Zelensky unveiled a plaque for the UK prime minister on the "alley of bravery" outside the Ukrainian parliament.
In a Facebook post, Mr Zelensky said he was "glad to welcome" Mr Johnson who he described as "a great friend of Ukraine".
He thanked the UK prime minister for "the uncompromising support of our country from the first days of full-scale Russian aggression, for the steadfast defence of Ukraine's interests in the international arena!
"Our country is lucky to have such a friend!"
Boris Johnson referenced how President Putin is effectively using the energy crisis as an indirect weapon of war - to "torment households."
His message to the public that they must "endure" that pressure is striking.
It sounds like an admission that we are vulnerable to such indirect "weapons of war" because we have not yet secured our own energy independence through homegrown supplies.
If we had done that, we would not be as exposed to international price shocks.
He may not have meant it as such, but his words serve as a challenge to whoever succeeds him as prime minister.
They are under pressure to help households with their winter fuel bills, ahead of the energy price cap announcement on Friday.
But they will also need to show how they can rapidly fix the fundamental problem, of domestic supplies not meeting demand.
Other world leaders have also paid tribute to Ukraine as the country marks 31 years since it gained independence from Russia.
US President Joe Biden said Ukrainians have "inspired the world with their extraordinary courage and dedication to freedom".
Mr Biden also confirmed $3bn (£2.5bn) of fresh US military support for Ukraine - the biggest American package yet - which will help Ukraine to acquire weaponry and equipment.
Mr Zelensky said he was grateful to the US for their "unwavering support".
The Ukrainian president has vowed to "liberate" all of his country's territories occupied by Russia without "any concession or compromise".
Elsewhere, Labour leader Sir Keir Starmer met Ukrainian soldiers being trained by British Army officials at Salisbury Plain.
He said: "The UK remains totally united in the face of Russian aggression. Our commitment to the Ukrainian people will never waver."