There is a weekly cap of 50,000 Resources (net) that can be gained from each Castle. This limit is officially called the Rolling 7-day-Limit. The seven days in question begin immediately after the first Raid. On the 8th day, you can raid the same amount of Resources you raided the first day, so the 50,000-Resource balance is kept constant. This limit includes both Resources gained from successful Raids and those sent to you willfully as Gifts.
Bear in mind that there is an additional daily limit: no more than 500,000 Resources can be Raided from other Castles.
Remember: 5% of captured Resources will be subtracted as the cost of the Raid.