On release of the sales order you can write a new function and call it, to check whether more than three items are added in the sales line and pop up a error.
In your case I would also filter for SalesLine2.SETRANGE(Type,Type::Item); as if there would be any other type of lines on the sales order (Item (Charge) or G/L Account for any discount, etc.), then you order would surely have at most 3 lines, but not 3 item lines.
Answers
Are there a specific reason that you need to limit the number of item instead of the amount ?
SalesLine2.Setrange("Document No.", SalesHeader."No.");
SalesLine2.Setfilter("No.",'<>%1,'');
if SalesLine2.Count > 3 Then
ERROR('You can only insert 3 lines into an Order');
this is my coding