The 28-year-old previously spent three-and-a-half seasons with Roma but moved to the Chinese side in the summer of 2019 for a reported €16m.
Shaarawy scored 40 goals in 139 appearances in his first spell with the Giallorossi, whom he joined from AC Milan in 2016.
"When I arrived in Rome the first time I realised how little time it takes for this club and this city to make a deep impression on you," Shaarawy told the club's website.
"When I left I quickly realised that both would always be in my heart. Now I cannot wait to be once again representing this club and these colours."
General manager Tiago Pinto said: "Everyone knows the quality El Shaarawy has, but few are aware of the full extent of his desire to come back and wear the Roma shirt once more – and it is that desire and belief in our project that made all the difference.
"Today we are delighted to welcome him back to the club once again."
Shaarawy has been capped 28 times by the Italian national team with six goals to his name.
Ahead of Sunday evening’s home game against Hellas Verona in Serie A, Roma are fourth on the league standings with 37 points.