Pepe, 35, spent three seasons at Porto from 2004-07, winning two league titles before a 30 million-euros ($34.3 million) move to Real Madrid, where he spent the next decade, winning three La Liga crowns and lifting the Champions League trophy three times.
The rugged defender, who will be reunited at Porto with former Real Madrid team mate Iker Casillas, joined Besiktas in 2017 but rescinded his contract with the Turkish club last month.
Benfica win another league title after crushing Santa Clara
Porto are six points clear at the top of the Portuguese top flight.
'A big scare' - Casillas posts photo from hospital after heart attack
Mourinho rejects chance to manage Benfica - reports