A main route has been closed and homes could be evacuated after a gas main was struck during roadworks.