GaN and related materials have excellent electrical, optical and chemical properties for a wide range of applications including high power, high temperature electronics, LEDs and lasers, sensors, and MEMS in harsh environments. Due to its high chemical stability, GaN is resistive to common etchants, and poses a challenge for fabrication. Micromachining techniques for GaN and related materials based on photoelectrochemical (PEC) etching, which overcomes the chemical stability of GaN by photogenerating electron-hole pairs in GaN during etching, is developed and demonstrated. Although many excellent results have been obtained with dry etching techniques, a viable photoelectrochemical etching (PEC) approach is still attractive since PEC etching is expected to result in less damage as well as offering unique characteristics such as dopant-selective and bandgap-selective etching. In this study, PEC etching of GaN and related materials is demonstrated, the mechanism of PEC etching of GaN is investigated, and a two-step etching model for PEC etching of GaN is developed. In addition, the relationships between etch rate, etched surface morphology and the incident light intensity and electrolyte concentration have been studied. Control of the etched surface morphology, which is critical for many device applications, has been investigated and demonstrated. Prior reports of PEC etching have shown that rough surfaces, related to the high density of dislocations in the material, are typically attained. Through study of the effect of electrolyte concentration, light intensity, and applied voltage bias, conditions that produce a very smooth surface with root-mean-square surface roughness of approximately 0.5 nm have been identified. Lateral PEC etching of GaN by several approaches, including through-wafer (backside) illumination and bias assisted etching, has been investigated for the fabrication of deeply undercut structures. Use of an applied voltage bias was found to enhance the lateral PEC etching of GaN in front-side illuminated PEC etching, allowing the fabrication of suspended Ti cantilevers. Fabrication of SiO2 and AlGaN (dielectric and semiconductor) membranes has also been demonstrated. These processes are promising for fabrication of novel sensors and MEMS devices. Enabled by the etching techniques demonstrated in this research work, an inline transmissive microwave power sensor has been designed and simulated. It offers several advantages over conventional power sensors by allowing it to be easily integrated with low-loss coplanar transmission lines and GaN-based transistors. Thermal and electromagnetic designs and simulations of the sensor have been performed, and the relationships between its structure and performance, including the responsivity, response time (thermal time constant) and noise equivalent power have been established.