A trick that worked for me 10 years ago and I suppose it still works. For
spending more time at Machu Picchu, avoid the tourist train and board the
local train from Cuzco to Quillabamba (crowded by locals, chickens at al),
disembark at Aguas Calientes, less than 2 km before Machu Picchu station.
There are a couple of simple hotels and a relaxing hot spa (see the name of
the town), then the next morning walk along the rails the short distance to
Machu Picchu train station and board the bus to the ruins (the first one
ran at 8.00, while the tourist train arrived at 11.00). In the evening you
can either walk back for another night or board the train to Cuzco.
The ruins without the tourist crown are even more wonderful!