As mentioned beforementioned before there are commercial products available to solve this problem:
But that would be expensive and wouldn't be a proper life hack.
To save a little money you could just re-purpose an old pair of suspenders, you should be able to find them in thrift stores, provided you don't have a significant hipster population in your area...
With this style of suspenders you can carefully remove the stitching, to separate the two elastic strips. Then you will have two working sock/shirt garters for around $2.