We present microwave-frequency NbTiN resonators on silicon, systematically achieving internal quality factors above 1 M in the quantum regime. We use two techniques to reduce losses associated with two-level systems: an additional substrate surface treatment prior to NbTiN deposition to optimize the metal-substrate interface, and deep reactive-ion etching of the substrate to displace the substrate-vacuum interfaces away from high electric fields. The temperature and power dependence of resonator behavior indicate that two-level systems still contribute significantly to energy dissipation, suggesting that more interface optimization could further improve performance.