Extension of states Let $X$ be a Locally compact Hausdorff space and $Y$ is a compact subspace of $X$. Let $\phi$ be a state on $C(Y)$. Then can we extend to  $\phi$ to $C_0(X)$? Suppose if $T:f \mapsto f|_X$ is the homomorphism from
$C_0(X)$ to $C(Y)$, then will the map $\tilde{\phi}=\phi\circ T$ be a state on $C_0(X)$?

Okay, so I think this is true. As per my comment, we just need to check that this functional has norm 1. Positivity is in turn equivalent to $\lim_\lambda \tilde{\phi}(e_\lambda) = \|\tilde{\phi}\|$ for some (or any) approximate unit $(e_\lambda)$ for $C_0(X)$. So to solve this, lets find an approximate unit $(e_\lambda)$ which satisfies $\lim_\lambda \tilde{\phi}(e_\lambda) = 1$.
Just as in the wikipedia article for C*-algebras (https://en.wikipedia.org/wiki/C*-algebra#Commutative_C*-algebras), there is an approximate unit $(f_K)$, indexed by compact subsets $K \subseteq X$ for which $f_K|K = 1$ (Tietze extension/link in the comments). With this idea in mind, its not hard to construct a net $(f_K)$, indexed by compact subsets $K \subseteq X$ which contain $Y$, such that $f_K|_K = 1$. This is our desired approximate unit:
$$ \lim_K \tilde{\phi}(f_K) = \lim_K \phi \circ T(f_K) = \lim_K \phi(f_K|_Y) = \lim_K 1 = 1. $$
