Many government buildings in Portugal (e.g. the council or library) offer free WiFi, and you can sit outside and use it. Then, of course, cafes, restaurants and bars have public WiFi, as well as hotels, hostels, villas and apartments.
Often (although less so these days) the WiFi password in a cafe is the phone number of the cafe or the name of the network.
Most of the trams and busses don’t offer free WiFi, but Lisbon’s metro does!
You can also buy a Portuguese SIM-card or a portable mobile internet device that can have multiple devices connected to it (Portugal Internet, WiFiabroad – only available in the Algrave, MyWebSpot offer those, for example).
Now you can use a SIM-card from another EU country within Portugal and you will not pay roaming charges. Depending on the provider, you can keep doing this for several months.