The Winchburgh tunnel near Linlithgow will be closed for six weeks.
Main line commuters will have to switch to buses for part of their journey, or switch to one of the other three, slower routes between the cities.
However, ScotRail has already warned that rush-hour trains may be so crowded that some travellers may be unable to board.
It has advised passengers to set off up to 30 minutes earlier than usual.
The work is part of a £750 million upgrade to enable faster-accelerating, roomier and quieter electric trains to run from the end of next year.
The tunnel closure, revealed in 2013, is necessary so tracks can be lowered to create space for overhead power lines for the new trains.
Track firm Network Rail said the work had been arranged for early summer because it was the quietest time on the railway.
The first line closure takes place on Saturday and Sunday, when buses will replace trains between Edinburgh and Polmont.
Passengers on the Edinburgh to Dunblane and Alloa lines will also be affected, with replacement buses between the capital and Falkirk Grahamston. The same closure will happen the following weekend – 6-7 June.
Over the 13-14 June weekend, buses will replace trains for passengers on both lines between Edinburgh and Falkirk Grahamston, to where Glasgow trains will be diverted.
Then from 15 June to 25 July, no trains will run between Edinburgh and Linlithgow, with replacement buses.
Passengers will have the option of changing to or from Edinburgh-Dunblane trains at Linlithgow.
However, as these will have to be diverted via Dalmeny, near the Forth Bridge, they will take some 25 minutes longer than normal.
To complicate matters further for weekend travellers, no trains will run on Sundays between Edinburgh and Falkirk Grahamston from 21 June to 26 July – the final day of the works.
ScotRail has urged travellers between Edinburgh and Glasgow to use the secondary lines via Bathgate, Shotts or Motherwell instead.
The train operator said it would add extra carriages “where possible” and run more evening rush-hour trains.
However, it warned: “If you normally board at an intermediate station, you may not be able to get on the first train you aim to catch.”
Further pressure will come during the Open golf championship at St Andrews from 12-19 July, when many fans from across Scotland normally travel by train. ScotRail said it expected to lay on more buses during the latter part of the week.
Passenger watchdogs said ensuring travellers were fully informed was crucial. Transport Focus manager Robert Samson said: “The rail industry will need to work hard during the project to be on hand to provide passengers with the necessary help and information to minimise that inconvenience.
“The industry should also consider offering discounted tickets and compensation for passengers inconvenienced by this engineering work.”
A ScotRail spokesman said: “The improvements planned at Winchburgh will mean customers will see changes to their normal journeys. We would urge you to take action now. Our website [scotrail.co.uk] has all the information you will need.”