The assault occurred on The Loan in South Queensferry at around 1.30am.
Police investigating the incident near the Scotmid store have appealed for witnesses to come forward.
The victim is being treated at Edinburgh Royal Infirmary.
Detective Inspector Raymond Brown from Police Scotland said: "This was a violent assault where the male received significant injury and an investigation is ongoing.
"We are appealing for anyone who was in or near The Loan around 1.30am and who witnessed a disturbance to contact police immediately. We are also keen to trace a car that was seen in the area at the time."
Chief Inspector Mark Rennie said: "I'd like to reassure residents that at this stage this appears to be an isolated incident and following our initial investigation we have now reopened The Loan to all traffic.
"We will also have officers in the area tonight to reassure the public and carry out further enquiries."