Tesla Inc. and BYD Co. set sales records in the second quarter, likely widening their lead as the world's top electric-car makers.