What you need in order to see from country A to country B is not just the distance between them but elevation. The higher, the better. If the two countries are separated by water, then assuming ideally clear weather, what matters is whether the line of sight between the point you're standing at and the point you're trying to see dips below the surface of the ocean between them. Therefore the distance between those two points must be no larger than the sum of their horizon distances, which are a function of their elevation.
So look for mountains, not beaches.
The place in Morocco whose horizon distance reaches farthest in the direction of Portugal might be Jebel Kelti (1912 m) about halfway between Tetouan and Chefchaouen, with a horizon distance (corrected for atmospheric refraction) of 169 kilometers. I've sampled a number of hills closer to Tangier, but they are all lower and their lines of sight don't reach as far into the Atlantic.
The highest point in Algarve is Fóia at 902 m, with a horizon distance of 116 km. I'm not sure if there are any almost-as-high peaks further east in Algarve, but ultimately that doesn't matter because the distance from Jebel Kelti to anywhere in Portugal is 277 km, and the sum of the horizon distances is 285 km. There certainly isn't anywhere as high as 902 m within the few dozen square kilometers of Portuguese coastal marsh that fall inside the 285-km circle.
Thus even assuming perfectly clear air and a telescope, you can't see any part of Morocco from anywhere in Portugal. (Except possibly in the case of very unusual meteorological conditions over the Gulf of Cádiz, which might in theory enable a looming image of Kelti to appear above the horizon).