Herein, we report a siloxane-encapsulated upconversion nanoparticle hybrid composite (SE-UCNP), which exhibits excellent photoluminescence (PL) stability for over 40 days even at an elevated temperature, in high humidity, and in harsh chemicals. The SE-UCNP is synthesized through UV-induced free-radical polymerization of a sol-gel-derived UCNP-containing oligosiloxane resin (UCNP-oligosiloxane). The siloxane matrix with a random network structure by Si-O-Si bonds successfully encapsulates the UCNPs with chemical linkages between the siloxane matrix and organic ligands on UCNPs. This encapsulation results in surface passivation retaining the intrinsic fluorescent properties of UCNPs under severe conditions (e.g., 85 degrees C/85% relative humidity) and a wide range of pH (from 1 to 14). As an application example, we fabricate a two-color binary microbarcode based on SE-UCNP via a low-cost transfer printing process. Under near-infrared irradiation, the binary sequences in our barcode are readable enough to identify objects using a mobile phone camera. The hybridization of UCNPs with a siloxane matrix provides the capacity for highly stable UCNP-based applications in real environments.