I am looking to book a train from Lisbon to Madrid and can only find a bus trip. I believe there used to be an overnight train but can't seem to find it on the internet. Does anyone have any info on this? Perhaps better to fly?
Yes, the night train was a victim of the pandemic and doesn't run at the moment. Hopefully it will return in the future, but we can't be sure.
Doing the trip by day train is possible but a bit of an adventure: https://www.youtube.com/watch?v=-tUbLnBivIw There are direct buses though, and to be honest the long distance buses in Spain and Portugal is usually pretty nice. Another option is to take the train via Vigo and Porto. Or, as you mention, to fly.
What's your overall itinerary?
Lisbon to Madrid is OK by bus, but it takes a while, and the train is cumbersome as Badger's link shows.
If you want to avoid flying, you could shorten the journey by stopping over in Evora, Cáceres, or even both.