But i want to know, is there any reference for using heatsink if the watts passed the margin?
This reference is Tj ( Junction temperature in transistors)
The maximum temperature of transistors is normally 150°C, however, we recommend usage at less than 100°C.
You can calculate this by ---
Maximum allowed power dissipation
The junction temperature rises due to consumption of electrical power within the transistor and increases in ambient
temperature.
The maximum allowed power dissipation is the amount of power consumption needed to raise the
junction temperature to the maximum allowed rating.
PCMax. = (TjMax. − Ta) / (Rth (j − a))
TjMax. is the maximum allowed junction temperature,
Ta is the ambient temperature, and Rth (j − a) is a thermal
resistance where (j − a) includes all thermal resistance from the junction to the external air.
By using a heat sink for improved heat dissipation, the thermal resistance can be reduced and
allowed power dissipation improved.
Also, only DC allowed power dissipation is normally indicated. When a transistor is used for switching, the rating can
sometimes be exceeded. In the case of saturated switching, the transistor moves between the saturated region
and the cutoff region. In both regions power dissipation is low, and if the power dissipation of the transient state
which moves along the load curve can be ignored, it can sometimes be acceptable for the operating point to move
into the
VCE × IC > PCMax.
region provided the voltage and current ratings are not exceeded. The maximum allowed power dissipation has
been determined based on repeated reliability and damage tests, however, we recommend use at 75% of the rated
value.
Good reading ( read at least 3,4 and 5 )
Operation notes : Transistors
Rev.A 1/7
Selecting semiconductor devices
**broken link removed**
Example : Datasheet Power dissipation in BC639