Same here, i have 40 odd devices over 2 gateways and stable. As Jim mentioned, its always an issue with the network that causes the devices to go offline.
There an a number of posts on how to minimise interference between zigbee frequencies and WiFi.
The limit is 30 devices per gateway and remember if you have more than one each gateway is its own zigbee network.