Caledonian Sleeper is to pass into public ownership when the present Serco contract ends in June.
Transport minister Jenny Gilruth has announced the decision to MSPs at Holyrood.
She said that management of the Caledonian Sleeper will pass to an arms-length company owned by the Scottish Government on 25 June.
She also criticised the pace of railway reform in England, saying that the London government is 'not going far enough', and that it was 'very unclear' when the changes proposed in the Williams-Shapps report, which recommends the creation of the guiding mind Great British Railways, will come about.
She confirmed that the terms and conditions of the employment of sleeper staff would be protected when they are transferred to the state-owned company.