Settings in Postgresql can be made on three levels:
As you have already discovered, you can change individual settings on a session basis using set.
You can set parameters persistently on a per-user basis using the ALTER ROLE command. This can be set for a single database or for all databases in the server.
To change settings on a global basis, persistently for all users, you can edit postgresql.conf. Later versions of postgresql also allow changing global config via the ALTER SYSTEM command. In addition, global configuration overrides can be made by adding command line options when starting the server.
Not all parameters can be changed per session or per user.
Changes to postgresql.conf will not take effect until you reload the server (pg_ctl reload, or via appropriate system init command). Some parameters require a complete restart to take effect.
This manual page describes the different methods in more detail.