Always have an escape route! Someplace to go other than the back of the vehicle that you are following, or the front of what is approaching. Usually the emergency lane, shoulder, or space between vehicles.
When my son first started riding his Gs 550 ES, he got caught in traffic on a freeway that was being worked on. He was in the inside lane with little room to escape in, cones and sharp shoulder on the left. The car in front of him breaked sharply, My boy took the only escape route that he had and went left, missed the car, barely, and ended up running over a couple cones before dropping over the shoulder and coming to a stop on his side. He was able to slow down enough to only receive a few scratches on the bike and roadrash on his right knee. We talked about it afterwards and he mentioned that he should have been in the outside lane where the good emergency lane and excape routes existed.
We also talked about watching not only the tail lights of the car in front of him, but also 4,5,6 or more ahead so that he has some warning of what is coming.
Ride safe