We propose a compact fluorescence intensity ratio (FIR) based temperature sensor packaged in a capillary with an embedded fiber microlens. It is composed of a cone-shaped inwall capillary coupling a fluorescent microsphere as the emitter port, a graded-index fiber (GIF) microlens as the detector port, and a large-inner-diameter capillary as the package. The emitter and detector ports are both conjoined with single mode fibers, with stepped profiles formed by etching. This structure makes them freestanding and aligned in the package capillary, improving the stability of the device. The embedding of microlens makes the device integrated and thus practical. Its effective length range from 249.5 to <inline-formula xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink"> <tex-math notation="LaTeX">$295.2~\mu \text{m}$ </tex-math></inline-formula> is obtained by the ray matrix model of Gaussian beam, and verified experimentally. This integrated device can be applied in space-limited environment with a linear sensitivity of <inline-formula xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink"> <tex-math notation="LaTeX">$1.11\times 10 ^{-2}\,\,\text{K}^{-1}$ </tex-math></inline-formula> in the region of 303.15-383.15 K. Combined with advantages of robust structure and low cost, it has great potential in temperature sensing applications.