well it was obvius that they liked each other in the 4th book,and harry ব্যক্ত he had an inkling it might start happening and he didnt know it would messup the friendship অথবা be to embarresed if they start snogging (kissing)in public, while in herbology.
Of course he knew. He was perfectly aware of it from Goblet of আগুন on. He just thought it was none of his business, অথবা found it weird অথবা was (rightfully) afraid how it might affect their friendship. Plus he was also a little jealous, after all what if the two of them got together and he'd be the fifth (this case third) wheel and he'd be left out and alone.
I think that he kind of knew during the 4th book. because ron got really jelouse, and then she ব্যক্ত that পরবর্তি time he should ask her out befor anyone eles so he would not be that jelouse