This depends on which route you wish to take.
By the A2 Motorway toll road/A22 freeway just less than three hours with one stop.
By the coastal route via Marateca, Grandola, Mimosa, Odemira, Odeceixe, Aljezur, Lagos about 4 to 4,5 hours.
By the old IC1 national road/ A22 freeway via Marateca, Grandola, Mimosa, Ourique, Vale Praiaso, Portimão about 4 hours.