It is understood that the roof of the property at Mosside Drive, Blackburn, caved in, smashing into the stairwell below.
Emergency services rushed to the scene at around 9:30pm.
Trapped residents living on the top floor were asked to remain in their property while West Lothian Council and fire crew made the building safe.
There were no reports of any injuries. Fire crew left the scene around 2:30am this morning.
A council spokesman said no residents were evacuated and no temporary accommodation is required.
A spokesperson for the Scottish Fire and Rescue Service said: “The Scottish Fire and Rescue Service was alerted at 9.26pm on Thursday, July 26 to reports of a collapsed roof structure within the stairwell of a block of flats in Blackburn, West Lothian.
“Operations control mobilised a number of resources to the four-storey building on Mosside Road.
“There were no casualties.
“Residents were offered reassurance advice and requested to remain inside their properties while firefighters worked to make the area safe.”
The Mosside Drive block of flats were used in a scene for last year’s Trainspotting sequel T2: Trainspotting.
In the scene, the character Begbie, played by Robert Carlyle, can be seen walking into the flats.
Join our Facebook group Our Edinburgh to share images and news from and around the Capital