Typically your master breaker is sized to be less then the sum of all of the sub breakers. The reason for this is in a typical house, you don't pull the maximum current from all branches at once. However, this setup does allow for the situation that you are running into where your master breaker can trip even though none of the sub breakers have tripped. There is nothing unsafe about this setup, but as I am sure you are aware, it can be very annoying to have the whole house loose power.
In order to deal with this, you should look into what exactly it is that is happening to trip the main breaker. For example, is it the AC kicking on while a refrigerator is running? Or is there some other circumstance that causes the breaker to trip? Once you figure out what this situation is, you will know if it is possible to just avoid pulling too much power.
If you do need to be able to pull more power, you will need to look into the specs of your distribution panel. It could be that it is not capable of handling more than 40 amps. Or potentially, depending on your location, the main service lines can't handle more than 40 amps. It is difficult to tell you what your situation can handle, but this is the path you will need to look into.