The answer is, Yes. But not in the fashion that the others are proposing
While an SSR or Contactor is perfectly reasonable Device for this application, using a Raspberry PI as-is especially one that is hosting other services is not the appropriate controller for this application. This applies to the software and hardware portions.
Keep in mind, that when choosing a contactor or SSR, it is suggested to give yourself a lot of overhead, a 40A circuit should probably use a 200A Rated Contactor or SSR.
1. It is essential that there is a dedicated controller which is responsible for maintaining the state of your power control relay 24/7/365.2422
The raspberry pi can be used as your home automation server, but you need an intermediate, more permanently installed layer. In the most basic sense this class of devices is known as a Programmable Logic Controller (PLC), which, if you allow my analogy, is a simple ruggedized "Arduino", at least for this application
There are a variety of PLC's on the market and most are fairly expensive, however there are a few inexpensive ones constructed from arduinos and Raspberry PIs. They come with a variety of input/output interfaces, from simple digital I/O to TCP/IP
The PLC is responsible for maintaining the safe state of the switched circuit in isolation from the higher level control server, this provides a level of reliability, and also, the ability to add a manual override, or cutout switch easily.
In commercial buildings and public places you may have noticed this equipment before, often used to control various light fixtures, fans, etc.
2. Choose a Switching Device
SSR or Contactor, I would recommend one that can mount on a Rail.
3. Find a permanent installation for the equipment
The Raspberry PI, and potentially, even the contactor can be mounted in the same location
The PLC is mounted in a cabinet, which can double as a junction box (for electrical wiring) or otherwise mounted near the feed in for the room.
Typically you mount equipment on standardized "DIN rails", and there area number of cases for the raspberry which have this mounting standard.
For wiring connections, terminal blocks are used to make a reliable electrical contacts in permanent installations
4. Ask a Professional Electrician to do this work for you
Designing Home Wiring with Boxes for a PLC is something an Electrician would understand and be able to do the work for you, perhaps even assist you in planning/designing.