The Scot signs a two-year deal with the Perth side.
Swanson has had two spells with St Johnstone previously, scoring 11 goals in 44 appearances.
Manager Tommy Wright spoke on the signing: "Danny is a player that needs no introduction to the fans.
"They know exactly what his qualities are and what he's capable of.
"I've always felt that Danny has been at his happiest here and that he's played his best football at this club. It's my job to make sure I get the best out of him again.
"Competition for places has never been higher and at the top end of the pitch we're looking really strong. It's my task now to manage that because not everybody can play every week.