A vital road link into Edinburgh is to be closed for four nights later this month to install new traffic lights at a notorious junction.