Wireless sensor and actuator networks (WSANs) are seeing increased acceptance in the real world because of their potential to increase productivity. These wireless but limited systems can be applied in a wide range of problems ranging from logistics to e-health, due to their moderate cost which promotes redundancy and close observation of phenomena, as well as network-level self-organisation which promotes mobility and eliminates the need for infrastructural engineering. Yet, this class of systems is not without its challenges energy as well as resources are limited, the individual node is unreliable and the total number of nodes is high. Mentioned limitations are traditionally mitigated by careful engineering of the single application using the WSAN. Existing research has focused on providing optimal support for this monolithic usage mode. Real-world applications however are generally not monolithic driven by cost-effectiveness, a single sensor (network) must support multiple applications of diverse users, and nodes of networks owned by different parties must work together to achieve the goals of their users. The WSAN ecosystem is shared since users are competing for the scarce resources, aswell as federated since finishing a task will often require cooperation spanning logical network boundaries. Improving support for shared usage and federated operation of WSANs is the overall goal of this dissertation. The envisioned federated setting with multiple owners and users of networks raises additional requirements that are mainly security-centric from a runtime perspective. Fine-grained control of resource consumption is needed, next to provisions for modularity and dynamic reconfiguration that were already established through multi-application but single-owner usage scenarios. Trust established between the owners needs to be translated into the federated network so that servicesand applications on nodes can cooperate. The runtime perspective, however, only offers a partial view to the federated problem. The multiple applications of users are competing, but also asynchronously coexisting. Applications come and go at a different pace. This is not different from traditional multi-user systems where this problem is tackled by managing the lifecycle of each application independently culminating in resource-expensive virtualisation now basically replicating a full operating system for each application. In low-resource sensor networks, communality must be embraced and abandoning these lifecycle silos implies that the traditional individual sequences of develop > deploy > manage cannot be maintained. Instead a system-software continuum is proposed wherein all stakeholders submit application or system goals. Optimally translating (from a resource perspective) these goals to low-level artifacts and the enactment of the latter is a prime responsibility of enhanced WSAN middleware. This middleware enhancement is also a suitable place for autonomicity to address the impact of mobility and node failure. The contributions of this dissertation can be summarised as follows. The federated ecosystem is characterised and its requirements identified. To address these requirements from a runtime perspective, a middleware is proposed combining a component model and a policy-driven paradigm, with specific extensions for secure cooperation. This runtime middleware provides a modular, reconfigurable, and shareable execution environment for our target platform. Next, focus moves to the development support that is needed in the middleware from the continuum-lifecycle perspective. Suitable abstractions are proposed for the stakeholders of the federated ecosystem and the gap between those abstractions and the runtime execution environment is explored and addressed through a high-level description of the enhanced middleware. Finally, a subset of the enhanced middleware is presented in detail and validated. The latter demonstrates the optimisation potential of the continuum approach.