Williams was forced out of the goalless draw with Mexico after just 20 minutes, with subsequent x-rays showing that he sustained two fractures to two ribs which punctured and collapsed a lung.
The 33-year-old posted pictures to Facebook from his Beverly Hills hospital where he had his operation, writing:
"Crazy couple of weeks. Great to be back in a Wales shirt and with the lads. However, after coming off after 20 mins with multiple breaks on two ribs, I went to hospital and found out I had punctured my left lung which led to it collapsing."