In order to avoid this some places offer online prebooking of tickets. For the uffizi art gallery for instance they will give you a certain date and time to enter and you stand in a seperate line than the others. When I did this I still had to wait about 15 minutes to get in but thats nothing compared to 2-3 hours others have to wait.
You can reserve online through this link:
http://www.florenceart.it/booking/
I've also found out that for most places the best time to enter is late. So I visit the not so popular places, like the Bargello (my favourite museum - strange that it's not so popular) in the daytime and after 6pm go to the Academia for instance. You can just walk in, a few hours earlier the waiting line goes around the whole block.

