Lock database table for just a couple of sentences

Suppose a table in SQLServer with this structure:

TABLE t (Id INT PRIMARY KEY)

Then I have a stored procedure, which is constantly being called, that works inserting data in this table among other kind of things:

BEGIN TRAN

DECLARE @Id INT = SELECT MAX(Id) + 1 FROM t

INSERT t VALUES (@Id)

...
-- Stuff that gets a long time to get completed
...

COMMIT

The problem with this aproach is sometimes I get a primary key violation because 2 or more procedure calls get and try to insert the same Id on the table.

I have been able to solve this problem adding a tablock in the SELECT sentence:

DECLARE @Id INT = SELECT MAX(Id) + 1 FROM t WITH (TABLOCK)

The problem now is sucessive calls to the procedure must wait to the completion of the transaction currently beeing executed to start their work, allowing just one procedure to run simultaneosly.

Is there any advice or trick to get the lock just during the execution of the select and insert sentence?

Thanks.