This is true if and only if the complement of $U$ has codimension at least $2$. To see that this condition is sufficient see [this MO answer][1]. To see that it is necessary, see Sasha's example, or take any $X$ and any Cartier divisor $D$ on $X$ and note that for $U=X\setminus \mathrm{Supp}D$, $i^*\mathscr O_X(mD)\simeq \mathscr O_U\simeq i^*\mathscr O_X(nD)$ for any $m,n\in \mathbb Z$, so $i_*i^*F$ can't be $F$ for both choices. *Remark* for the codimension $2$ condition, you don't actually need smoothness. See the liked answer for more. [1]: http://mathoverflow.net/questions/45347/why-does-the-s2-property-of-a-ring-correspond-to-the-hartogs-phenomenon/45354#45354