The present study describes the production of biosurfactant from isolate B. licheniformis Ali5. Seven different, previously-reported minimal media were screened for biosurfactant production, and two selected media were further optimized for carbon source. Further, various fermentation conditions such as (pH 2–12, temperature 20–50 °C, agitation speed 100–300 rpm, NaCl (0–30 g·L−1) were investigated. The partially purified biosurfactant was characterized by Fourier transform infrared spectroscopy (FTIR) and matrix-assisted laser desorption/ionization time-of-flight mass spectroscopy (MALDI-TOF MS) and found a lipopeptide mixture, similar to lichenysin-A. Biosurfactant reduced surface tension from 72.0 to 26.21 ± 0.3 and interfacial tension by 0.26 ± 0.1 mN·m−1 respectively, biosurfactant yield under optimized conditions was 1 g·L−1, with critical micelle concentration (CMC) of 21 mg·L−1 with high emulsification activity of (E24) 66.4 ± 1.4% against crude oil. Biosurfactant was found to be stable over extreme conditions. It also altered the wettability of hydrophobic surface by changing the contact angle from 49.76° to 16.97°. Biosurfactant efficiently removed (70-79%) motor oil from sand, with an efficiency of more than 2 fold as compared without biosurfactant (36–38%). It gave 32% additional oil recovery over residual oil saturation upon application to a sand-packed column. These results are indicative of potential application of biosurfactant in wettability alteration and ex-situ microbial enhanced oil recovery.