We perform sanity testing to check whether a new software version is stable and performing well. Actually we check the condition of software to perform major testing on that because in some cases we cannot perform testing on a software. For example, I have developed new software and it is crashing the system and destroying the database every ten minutes. So it means we cannot perform testing in current state because software is not in safe condition. Basically, we perform sanity testing to check particular functionality which had errors in previous versions and was not able for further testing is ready this time for testing.
In smoke testing we check all major functions of software to see whether it is performing good enough to apply further testing. So it means that smoke testing is broad level testing but sanity testing is kind of a testing which focus on a particular functionality.
Some other technical differences between smoke and sanity testing are given below.
(1) Smoke testing is informal testing while sanity testing is formal testing.
(2) We can perform smoke testing at any time while sanity testing is performed at the beginning and ending of each phase of Software Development Life Cycle.
(3) Usually tester and Developer perform Sanity testing while smoke testing is performed by developers.