The Met Office said the reading had been registered at Heathrow - breaking the previous record set in 2006.
A level 3 "heatwave action" heat-health alert has been declared for all parts of England.
But in Scotland, forecasters warned of thunderstorms, torrential downpours and hail stones up to 1cm in size.
Lightning was also spotted in the north-east of England, with a storm breaking out near Antony Gormley's Angel of the North statue.
Hot weather may have been a "contributing factor" to a large fire which consumed about 30 acres of Thetford Forest.
Motorists on the M1 in Derbyshire faced delays after a lorry carrying batteries burst into flames, causing the motorway to be temporarily closed in both directions.
Meanwhile, five people were taken to hospital from the Royal Norfolk Show as temperatures rose to 31C (88F) in Norwich.
In Staffordshire, 80 people were stranded on the monorail at Alton Towers when two trains broke down.
Wimbledon spectators - who had been covering their heads with umbrellas, newspapers and towels - were advised to wear hats.
London was hotter than Rome and Athens, according to figures collated by the Met Office, but other parts of Europe saw temperatures rise above 40C (104F).
38.5C (101.3F)
Hottest temperature ever recorded in the UK - Faversham, Kent in August 2003
36.7C (98F) Recorded at Heathrow between 15:00 and 15:30 BST on Wednesday
7 degrees This much above average counts as "very hot" - 6 degrees over is just "hot"
5 days Length of time the max daily temperature must exceed average to count as a heatwave
Network Rail instructed train companies to slow down at vulnerable locations where tracks could buckle because of the heat.
Network Rail has said the heat could have been a factor in the derailment of a freight train in Lincolnshire on Tuesday.
Heatstroke - the heatwave killer
Heatwave myths: The tips and tricks that help you keep your cool
10 ways UK is ill-prepared for a heatwave
Eight low-tech ways to keep cool in a heatwave
How to sleep in hot weather
When does tarmac melt?
Health warnings were also issued to young children, the elderly and those with serious illnesses who are encouraged to stay in the shade, wear loose clothing and drink plenty of water.
Vicky Barber, from the British Lung Foundation Helpline, said: "During hot weather, the air we breathe has lower moisture levels than usual, which can have a drying effect on our airways.
"As a result, people with respiratory conditions such as COPD or severe asthma may find it harder to breathe, feel more tired, or find their lungs feeling heavy or tight."
Dr Angie Bone, head of extreme events at Public Health England, said: "Employers should ensure indoor areas are kept cool and consider allowing these individuals to travel to or from their place of work during cooler, or less busy times of the day.
"For those working or exercising outdoors, strenuous physical exertion during the hottest part of the day should be kept to a minimum."
Some schools have cancelled their sports days, including Castledon School in Wickford, Essex, and Christchurch Primary School in Ilford, north-east London.
People have been reminded to take care swimming in open water, after the death of a man believed to have drowned in a reservoir in Suffolk on Tuesday.
The heat has caused bin collections to be delayed across Bath and North Somerset because the circuit boards in the compactors of the bin lorries are overheating.
BBC Essex hired an ice cream van to give free ice cream to listeners, paid for by the station presenters and editor.
Breakfast presenter James Whale said: "It's going to be baking in Essex and our listeners are so brilliant we thought they deserved a treat."
One animal at the Cornish Seal Sanctuary has been making the most of the sunshine.
Pumpkin, a grey seal, has learned to jump on the sun canopy over his pool, which he uses as a hammock as he rolls around sunbathing.
He learned the trick in May but has been doing it every day recently because of the hot weather.
Hot weather can be fatal for many animals, and the RSPCA has reminded people never to leave a dog alone in a car on a warm day, even with the windows left open.
The PDSA has advised that pets should always have access to shade, and hutches should not be left in direct sunlight.
The UK has seen the hottest July day on record, with temperatures hitting 36.7C (98F).