A new method for optimizing the layout of device-routing systems is presented. Gradient-based topology optimization techniques are used to simultaneously optimize both device locations and routing paths of device interconnects. In addition to geometric considerations, this method supports optimization based on system behavior by including physics-based objectives and constraints. Multiple physics domains are modeled using lumped parameter and finite element models. A geometric projection for devices of arbitrary polygonal shape is developed along with sensitivity analysis. Two thermal-fluid systems are optimized to demonstrate the use of this method.