The text book suggested that the Sonogashira reaction carried out under inert atmosphere though, you do not need.
Of course, you can get the product in high yield when you do under N2 or Ar. Pd(0) is active species and Pd(II) is inactive one. The O2 can make Pd(0) to be Pd(II) though, it takes much more time. You have to worry about the oxidation of ligand when you use phosphine as ligand. Alkyphosphine is more easily converted to phosphine oxide than arylhphsophine. Therefore, you have to do experimental under N2 or Ar when you used alkylphosphine.