How can I lock projects at specific number of hours?

You can accomplish this by setting up allocations for a project on the Allocation & Forecasting screen. After setting allocations for a project in terms of hours, you can add the rule 'Prevent time entry after reaching allocated hours' to the project on its Projects > Settings > Assignment tab. Check CORE Help Center for details on setting up Allocation & Forecasting.