In order to satisfy the requirements of the high reliability of electric control unit (ECU) of the Diesel Engine, the thermal analysis of ECU was performed by using the software FLOTHERM based on the finite volume method. The temperature field of ECU was obtained under different operating conditions. The structural optimization of ECU was completed to solve the problem of local high temperature. As a result, the operational temperature of ECU is reduced under the allowable limit, and its reliability is improved. The physical experiment shows that the thermal analysis and structural optimization are valid. The local high temperature could be reduced effectively and the operational reliability is improved.