The blaze happened on a vehicle transporting 24 pallets of wine. Avon Fire and Rescue Service said it was called to the incident just before 16:00 BST. While there were no reported injuries, traffic was at a standstill.
The M4 westbound is one of the major routes connecting England and Wales.
Traffic monitoring service Inrix said at 3.21pm: “All traffic being temporarily held and queueing traffic due to vehicle fire on M4 Prince of Wales Bridge Westbound from J22 M49 to J23 M48.”
Cameras showed large plumes of smoke approximately halfway across the bridge.
Just after 4pm, the fire service said the blaze had been extinguished, adding: “Crews remain on the scene moving the cargo and ensuring the scene is safe.”
Avon and Somerset Police said in a statement: “A lorry fire on the M4 Prince of Wales Bridge has closed the westbound carriageway this afternoon, Wednesday, June 22.
“Police, fire and Highways teams are at the scene.
“Please use alternative routes wherever possible.
“Travel disruption is likely to affect the M4 and M5 in our area as well as Gwent.”
Motorists are advised to plan extra time for their journeys as there is a planned lane closure on the M48 Severn Bridge, with delays expected.
These are the diversion details to be found by following the hollow triangle diversion symbol on road signs:
– Leave the M4 at J21 and join the M48 westbound and use the M48 Severn Bridge
– Follow the M48 back to J23 of the M4 to continue your journey