About 3 months before usually I believe for buses and trains. Will depend on covid as well.
Trains from Glasgow to London are almost hourly so actually getting one shouldn't be an issue. The pricing aye, could get stung.
Another option for booking right now is the Caledonian Sleeper but its still £200 return based on 2 sharing. Fully refundable right enough.