Pep Boys agreed to be bought by Bridgestone for $947 million, with the board of the car-parts chain deeming the latest offer from the tire company better than a competing bid from Carl Icahn.