For drivers it is significant to have an appropriate intensity level of light for proper visibility of the road. But, driving a vehicle at night is very difficult task due to the direct headlights from vehicles which drives in opposite directions and uncontrollable light sources from outside. Moreover, when the headlights are dim, the intensity level of the light is not sufficient for the drivers which causes to increase the accidents rate rapidly specially in urban areas. This is mainly due to manual lightening systems. Therefore this research is focus on developing an efficient image processing based algorithm to ensure the sufficient intensity level of the lights to the ego-vehicle driver while providing the least intensity level for the opposite drivers automatically. A pixel-based image segmentation method was used to implement the proposal. Testing the algorithm was done in a simulated environment to verify the accuracy of the algorithm.