The warehouse stores your resources. The higher its level the more resources can be stored. The maximum level of the Warehouse (Like many buildings) is 30.
If your warehouse gets full you cannot gain anymore resources for that amount.
E.G. lets say your warehouse can hold 10000 resources.
If you have 10000 iron, 5000 wood and 9000 clay, you cannot gain anymore iron, however you can get 5000 more wood and 1000 more clay.
It is usually considered wasteful to build your warehouse up faster than your income (either from resource pits or through farming) and your HeadQuarters Building, as the resources used to build all that extra space could be used for more troops, or building up other builds.
In Packet worlds, a level 24 warehouse is requried in order to build your Level 3 Academy. Anything higher than that is only necessary if you farm resources faster than you can use them.
To get more resources in your Warehouse, increase its level:
Resources are used to build buildings and train troops.