In this paper, a collision avoidance algorithm (CAA) has been proposed using variable time headway considering heterogeneous traffic. The time headway used in the proposed CAA was tuned based on the traffic scenarios, the host vehicle's load conditions and the type of the lead vehicle that the host vehicle encounters in the traffic. The proposed variable time headway would help to avoid the intervention of the collision avoidance system during normal driving and gain driver's acceptance. The CAA was evaluated using a hardware-in-the-loop (HiL) experimental set-up integrated with the vehicle dynamic simulation software IPG/TruckMaker® for different categories of lead vehicles such as 2/3 wheelers, passenger cars, light commercial road vehicles (LCVs) and heavy commercial road vehicles (HCVs). From the results, it was observed that while following a HCV, a smaller time headway was sufficient to prevent a collision compared to following a passenger car, LCV and 2/3 wheeler. Copyright © 2016 by ASME.