The Netherlands international arrived at the Camp Nou from PSV in December 2010 but failed to make the impact many had expected at the Catalan giants.
He will hope a switch to the Greek champions, who have the option of extending his stay for a further two years, can help him find the form that first attracted Barcelona.
Two lengthy injury lay-offs hindered Afellay during his time in Spain and he made only 35 appearances for Barca either side of a loan spell at Schalke.
Afellay made his international bow in 2007 and was part of the Netherlands' European Championship squad in 2012.
However, he has not added to his 44 caps since November of that year.
The 28-year-old is the latest player to leave Barca during the close-season as Luis Enrique looks to mould his own squad, with the likes of Cesc Fabregas, Alexis Sanchez, Cristian Tello and Bojan Krkic having previously moved on.
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.