Judd Trump edged a much-improved Ronnie O'Sullivan 6-4 to make the semi-finals of the UK Championship in York.